Build Home NAS(1)External Disk and Samba
Samba FreeNAS and my USB Driver
1. Set Up USB Driver
> sudo apt-get install ntfs-3g
>sudo fdisk -l
Disk /dev/mmcblk0: 7969 MB, 7969177600 bytes
4 heads, 16 sectors/track, 243200 cylinders, total 15564800 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000c45c9
Device Boot Start End Blocks Id System
/dev/mmcblk0p1 8192 122879 57344 c W95 FAT32 (LBA)
/dev/mmcblk0p2 122880 15564799 7720960 83 Linux
Disk /dev/sda: 1500.3 GB, 1500301909504 bytes
255 heads, 63 sectors/track, 182401 cylinders, total 2930277167 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x1a91b9cf
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 2930277166 1465137559+ 7 HPFS/NTFS/exFAT
> sudo mkdir /mnt/driver1
> sudo mount -t auto /dev/sda1 /mnt/driver1
Error Message:
mount: /dev/sda1 is not a valid block device
Solution:
Reboot the system. Then I get.
> sudo mount -t auto /dev/sda1 /mnt/driver1
Error reading bootsector: Input/output error
Failed to sync device /dev/sda1: Input/output error
Failed to mount '/dev/sda1': Input/output error
NTFS is either inconsistent, or there is a hardware fault, or it's a
SoftRAID/FakeRAID hardware. In the first case run chkdsk /f on Windows
then reboot into Windows twice. The usage of the /f parameter is very
important! If the device is a SoftRAID/FakeRAID then first activate
it and mount a different device under the /dev/mapper/ directory, (e.g.
/dev/mapper/nvidia_eahaabcc1). Please see the 'dmraid' documentation
for more details.
Check if the driver exist
> sudo blkid
/dev/mmcblk0p1: SEC_TYPE="msdos" LABEL="boot" UUID="936C-7154" TYPE="vfat"
/dev/mmcblk0p2: UUID="c1398422-7a7c-4863-8a8f-45a1db26b4f2" TYPE="ext4"
/dev/sda1: LABEL="Seagate Backup Plus Drive" UUID="FA82E28182E241AD" TYPE="ntfs"
Give more AC Power to the USB
> sudo vi /boot/config.txt
Add this 2 lines and reboot the system.
max_usb_current=1
safe_mode_gpio=4
It works for me.
>sudo mount -t auto /dev/sda1 /mnt/driver1
Create the NAS_CLOUD disk
> sudo ln -s /mnt/driver1/nas_cloud /opt/disk1
And This command will show you the spaces on all the drivers
> df -l
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/root 7534284 4120116 3057852 58% /
devtmpfs 218252 0 218252 0% /dev
tmpfs 44508 228 44280 1% /run
tmpfs 5120 0 5120 0% /run/lock
tmpfs 89000 0 89000 0% /run/shm
/dev/mmcblk0p1 57288 20280 37008 36% /boot
/dev/sda1 1465137556 421344 1464716212 1% /mnt/driver1
2. Set Up Samba Server Side
> sudo apt-get install samba
> sudo apt-get install samba-common-bin
backup the configuration file
> sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bak
Some configuration Changes Here
[Sillycat-NAS]
comment = Sillycat NAS Dictory
path = /opt/disk1
read only = no
create mask = 0660
directory mask = 0771
valid users = @users
force group = users
Restart the Samba Server
sudo /etc/init.d/samba restart
Create a user to the system
> sudo useradd sillycat -m -G users
Give a password
> sudo passwd sillycat
Create a new samba password
> sudo smbpasswd -a sillycat
3. Test the Samba Connection
> sudo apt-get install smbclient
smbclient -L //localhost/sillycat-nas
Enter carl's password:
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.6.6]
Samba Port Number
Samba runs on TCP ports 139 and 445 and UPD ports 137 and 138.
4. Enable the Auto Mount
> sudo apt-get install autofs
sudo vi /etc/auto.master
+auto.master
/mnt/ /etc/auto.ext-usb --timeout=10,defaults,user,exec,uid=1000
Reboot the System and See.
It seem the autoFS does not work.
Solution:
> sudo apt-get install udev
> sudo fdisk -l
Disk /dev/sda: 1500.3 GB, 1500301909504 bytes
255 heads, 63 sectors/track, 182401 cylinders, total 2930277167 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x1bbe0d95
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 2930277166 1465137559+ 7 HPFS/NTFS/exFAT
Not working.
References:
http://mlitzinger.com/articles/raspberry-pi-nas/
http://www.makeuseof.com/tag/turn-your-raspberry-pi-into-a-nas-box/
http://www.howtogeek.com/139433/how-to-turn-a-raspberry-pi-into-a-low-power-network-storage-device/
http://pimylifeup.com/raspberry-pi-nas/
http://lifehacker.com/5822590/turn-an-old-computer-into-a-networked-backup-streaming-or-torrenting-machine-with-freenas
http://www.freenas.org/
http://users.wfu.edu/yipcw/atg/apple/smb/
old blog about samba
http://sillycat.iteye.com/blog/562697
http://sillycat.iteye.com/blog/562637
http://sillycat.iteye.com/blog/563766
Support More AC Power
http://dumbpcs.blogspot.ca/2014/07/getting-external-hdd-to-work-with.html
Build Home NAS(1)External Disk and Samba
猜你喜欢
转载自sillycat.iteye.com/blog/2254550
今日推荐
周排行