Build a NAS using a Raspberry Pi
A NAS is a Network Attached Storage also known as a File Server.
A NAS will allow you to connect an external USB hard drive which can be accessed by any computer on your network.
You can also remotely access directories and files contained in the SD card attached to your RPi'
Drive Enclosure Ideas and Hints:
- Raspberry Pi
- Network cable Or Wifi adapter
- USB hard disk (or USB thumb drive etc).
- USB cable.
- A powered USB Hub may be needed if your drive does not already have it's own power supply.
I am going to use an existing BT650 NAS and convert it to use the
Raspberry Pi board instead of the existing Linux based ARM processor.
Hoping to get better performance than the existing processor can give.
See my writeup here:.
The device I am using is really a 2 in 1 NAS and USB drive enclosure. I am going to use it in the USB drive mode.
The device is powered by a 12VDC 'brick' but 5V is available in the
controller board so I am going to tap into the 5V on the board to run
You could make your own enclosure and add a SATA/IDE to USB adapter.
With that adapter you could use an old IDE drive or get a new SATA drive and convert it to USB.
These converters usually come with a dual combination 12V & 5V
power adapter. The 5V can be tapped off to run your RPi board.
Search Ebay for [SATA IDE to USB adapter] or just [SATA USB adapter] if
you don't need the IDE function. I found the IDE useful to recover
forgotten data from all my old drives laying around.
I am currently running a 2nd NAS off one of these adapters on my Fedora Linux box with drive just sitting on the shelf.
Some older drive enclosures have built-in 12V & 5V power supplies
as well and could be made into a suitable NAS by adding the USB adapter.
You can of course use an off the shelf USB drive. USB drives with their
own power adapters are best. If not you will most likely need to use a
powered USB hub.
A new drive will need to be partitioned and formated.
A drive which is already partitioned and formated can be used as is.
It is best to have the drive formatted as one of the UNIX based formats
such as EXT3 or EXT4. These will give the best performance.
Drives formatted with Windows based formats such as NTFS, FAT32 etc can
be used. Performance will suffer some due to the extra overhead needed
to support the Windows formats.
format in a Windows type format you will need to connect
the drive to your Windows computer and do the partitioning and
Note Drives that are formated with UNIX formats can not be accessed if
you should choose to remove the drive from the NAS and attach it to a
Windows machine. Windows will not be able to see any data unless you
install 3rd party software.
Drives formated with NTFS, FAT32 etc can be moved back and forth and accessed by a Windows system.
Configurations will be different based on the type of formating.
Work in process below here:
Linux Live CD to format:
Configure ownership and permissions
File and Directory ownership and permissions must be set properly for
all files and directories on a disk. If not then you will get
permission denied or access denied errors.
Especially true if the drive you will use for your NAS was previously
formatted and used on another system and already contains files and
On the RPi (or ssh) go to your USB directory and do:
if any files are listed like this then you must be root to access them and you will get access denied from Win8
-rwxrwxrwx 1 [color=#0000FF]root[/color][color=#0000FF] root[/color] ..............
use chown command to change users to pi. This will change all files in the current directory to user=pi, group=pi
sudo chown pi:pi *
You may also need to set permissions on the files with chmod command.
The following command will change all files in the current director to
775 = rwxrwxr.x
sudo chmod 775 *
sudo chmod -R 775 * (use the -R to change all files in any sub directives as well)
chown root:pi *
chmod 775 -r /dev/xxxx