This article is a follow-up to help you expand the capacity of your RasPi. Now, its time to add an external storage to the Pi – in this tutorial we will be adding an removable 500 GB USB harddisk drive to our mini-computer and share it over network for wireless access using Samba server.
Installing and configuring an external disk drive on Raspberry Pi :
- While we can use a variety of file-systems on linux like FAT, FAT32 and NTFS. The best option is to use EXT4 for your disk-driver, to format it to EXT4 file-system using a windows computer we can use excellent, free utility MiniTool Partition Wizard.
- Once formatted properly, attach your disk drive to RasPi and boot it, make sure you connect the hard-disk via an externally powered USB hub, as RaspberryPi is not capable of handling too many USB powered devices reliably.
- To check whether our disk drive is detected by the operating-system, use the sudo fdisk -l command at the terminal and it should list our drive.
- Now, we will need to manually mount the disk-drive and configure it to load on every boot.
- Create an folder inside our disk so we can mount it. Use sudo mkdir -p /media/ExternalHd and sudo chmod 755 /media/ExternalHd to get this done.
- Use sudo blkid command and copy the UUID of the newly added disk, in my case this would be the /dev/sda1: LABEL=”NAS” UUID=”f477a7f6-67a5-cd01-2027-a4f667a5cd01″ TYPE=”ext4″ entry as shown below.
- Now, edit the fstab file using sudo nano /etc/fstab and add the UUID and other relevant details as shown below.
- Save the fstab file and exit nano, use sudo mount -a to mount the disk.
- The disk will now automount on every boot.
Sharing the Raspberry Pi storage over WiFi network using Smaba to create an wireless fileserver (NAS Storage) for cheap :
- We will now need to install samaba server on RasPi to make an networked fileserver, use sudo apt-get install samba followed by sudo apt-get install samba-common-bin to do that.
- Now, edit the samba config file to enable sharing. use sudo nano /etc/samba/smb.confand add the following to share our newly added disk driver over network.
comment = External USB Disk
path = /media/ExternalHd
writeable = Yes
only guest = Yes
create mask = 0777
directory mask = 0777
browseable = Yes
public = yes
- Restart samba server to make changes take effect.
- Now you can access this samba share over the network. Just access //YourPiLanIP/. You can also add this add as an network share for access like any other regular partition.