Submitted by Deepesh Agarwal on Mon, 10/15/2012 - 03:09
In the last RasPi tutorial, we configured the device to have an static IP on the network. 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.conf and add the following to share our newly added disk driver over network.
[ExternalHd]
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.
Comments
Electronics for training devise.
From Hopeless,
Can Pi be linked to a transmitter that will trigger a remote receiver over a distance of 1 mile. I need a low cost solution for a experiment often used in schools.
Thx
Hmmm...
Your best bet would be to use two RPi's connected to each other via internet if possible, another solution could be usage of an High Gain wifi network for sending and receiving of communication. Chinese options like these can help bring cost down :
High Power Signal King 2000mW 48DBI USB Wireless Adaptor
Latest 2000mW 13dBi usb wifi kasens G6000 High Power USB WiFi
Awesome
Hey, this is great, I didn't try yet, but this is so use full for a office and as well as home use.. :)
Thanks,
Chethiya.
Awesome
Hey, this is great, I didn't try yet, but this is so use full for a office and as well as home use.. :)
Thanks,
Chethiya.
Still can't get acess perms right
Well, I've tried this multiple times and even after using both Adafruit's Occidentalis and Raspbian “wheezy” distros, I can see the drive but can't write to it (both from a Win7 and Linux Mint machine). I always get "There was an error creating the directory in smb://raspberrypi/externalhd/." with the reason as Permission Denied. I believe I confirmed both the /etc/samba/smb.conf entries and the chmod 755 /media/ExternalHd one earlier in the process. The only thing I altered in the whole process was to substitute "ExternalHD" for every "ExternalHd" as for some reason caps for HD seems more correct to me.
I've tried formatting the external drive as both NTFS and EXT4. It's EXT4 now.
Actually I just checked and even using SSH to remote into the Pi, I can't "mkdir" a folder unless I sudo the command.
Must be something simple but I'm overlooking it.
Ideas??
Permission issue...
Hi,
I am no Linux expert but this seems a "Permission" issue, you should try logging as root and changing permission as 0777 for the directory.
Thanks
Permission Issue
I followed the directions above and also had the permission issue... I rebooted my Pi and every is working fine...
Submitted by admin on Mon, 10/15/2012 - 11:23.
"Your best bet would be to use two RPi's connected to each other via internet if possible, another solution could be usage of an High Gain wifi network for sending and receiving of communication. Chinese options like these can help bring cost down."
What hardware do I need, two RPi, two antennas, Remote control to activate, transmission and receiving hardware.
Seventy not much time left.
thx
thanks
it works fine a did as said and it works thanks for the post very helpful.
Neat idea about getting the UUID!
I've looked at several of these howtos, and yours is the first that actually recommends adding the UUID to fstab instead of a partition/device entry. I really like this as one of the hard drives will always be attached to the Pi (sda) but the other is a 2TB drive I use for multiple machines. Being able to have it come back and mount in a predictable location is a must for a Pi-NAS.
Add new comment