Thursday, September 6, 2012

Raspberry Pi - Setup Windows NAS storage using SAMBA server

Easy steps to Setup Windows NAS storage using SAMBA server on  Raspberry Pi
  1. Connect pi using putty or other similar tool 
  2. Now lets make sure system is up to date using 
    • sudo apt-get update
  3. Connect your external HDD to Raspberry Pi. Execute following command and look for 
    • pi@raspbmc:~$ sudo fdisk -l
    • Disk /dev/mmcblk0: 3965 MB, 3965190144 bytes
    • 4 heads, 16 sectors/track, 121008 cylinders, total 7744512 sectors
    • ...........................................................
    • ...........................................................
    • Sector size (logical/physical): 512 bytes / 512 bytes
    • I/O size (minimum/optimal): 512 bytes / 512 bytes
    • Disk identifier: 0x00186eb3

    •    Device Boot      Start         End      Blocks   Id  System
    • /dev/sda1              63  1953520064   976760001    c  W95 FAT32 (LBA)
  4. Let's create following directory 
    • sudo mkdir /mnt/hdd_tb
  5. Edit following file and add last line
    • sudo vi /etc/fstab
    • proc            /proc           proc    defaults         0       0
    • devpts          /dev/pts        devpts  defaults        0       0
    • /dev/mmcblk0p1  /boot           vfat    defaults         0       0
    • /dev/mmcblk0p2  none            swap    sw               0       0
    • /dev/mmcblk0p3  /               ext4    defaults,noatime 0       0
    • /dev/sda1       /mnt/hdd_tb     vfat    defaults         0       0
  6. Mount the HDD
    • sudo mount -a
  7. List the hdd contents
    • ls /mnt/hdd_tb
  8. Now install SAMBA
    • sudo apt-get install samba
    • sudo apt-get install samba-common-bin
  9. Edit smb.conf based on your need using following command. There are many tutorials available online.
    •  sudo vi /etc/samba/smb.conf
    • [usb]
    • comment = USB Share
    • path = /mnt/hdd_tb
    • read only = No
    • create mask = 0777
    • directory mask = 0777
    • guest only = Yesguest ok = Yes
  10. Start SAMBA service
    • sudo service samba restart
  11. Access the files using 
    • \\<IP ADDREES>\usb