The Raspberry Pi as a simple DIY NAS

Network-attached_storage (NAS) devices are becoming increasingly popular. I thought it would be interesting to try using a Pi with a USB HDD to make a simple DIY NAS as backup for my home network. After plugging in the HDD I used “dmesg” to check the device and then I formatted it with a command like

% sudo mkfs.ext3 -L ‘freecom2tb’ /dev/sda1

I use EXT3 only because I’m old enough to remember when EXT4 was experimental, and not for any good reason (actually, I’m old enough to remember when EXT2 was considered somewhat avant-garde, but that’s another matter…). Once formatted, it can be mounted temporarily with a command like

% sudo mount -t ext3 /dev/sda1 /mnt

For a more permanent solution, first create a mount point for it with a command like

% sudo mkdir /mnt/sda1

and then add a line to the fstab with a command like

% sudo echo “/dev/sda1 /mnt/sda1 ext3 defaults 0 0″ >> /etc/fstab

Then the drive should mount on /mnt/sda1 automatically on boot. Once the storage device is enabled, you need to consider how to make it available over the network. If SSH is enabled on the Pi, then simple “scp” is supported already. For more “live” file system access, NFS or Samba can be used. As I want to use this for backup, “rsync” is all I want, which can be installed with

% sudo apt-get install rsync

That’s it. The Pi is now sitting on the network acting as an rsync destination. It’s not very fast, but it seems to work quite reliably, which is probably fine as a backup solution.

 

Advertisements

Published by

darrenjw

I am Professor of Stochastic Modelling within the School of Mathematics & Statistics at Newcastle University, UK. I am also a computational systems biologist.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s