Rok Mihevc Photo Projects Travel CV      Subscribe to RSS Feed

HowTo – Debian Live NAS with USB

01 May 2012 – Logatec

I had an old computer or two lying around, so I decided to cannabalize them and make a cheap NAS with the old disks. The main ideas were to keep it easy to maintain and to buy no extra components.
Here’s what I did:

  1. Hardware: I used an old desktop computer with BIOS that can boot from USB and an old 1GB USB stick (500 mb would be enough)
  2. I downloaded Image Writer for Windows and burnt Debian Live image (debian-live-6.0.4-i386-standard.img in my case – I only wanted the command line) to the USB.
  3. Plugged the USB in and opened BIOS, to set it as first in the boot order.
  4. In the boot manager press Esc and write “live persistent”.
  5. Install some packages needed – “sudo apt-get install parted ssh samba ntfs-3g hdparm”
  6. Partition the nonpartitioned part of the USB by: “parted /dev/sda” (where /dev/sda is the USB stick you’re using). Use “help mkpart” and “print” to help with partitioning. Make a new partition by e.g.: “mkpart primary 302MB 1011MB”.
  7. Make a filesystem on the new partition: “mkfs -t ext2 -L live-rw /dev/sda2”
  8. Configure the bootloader, so it boots automaticaly after 5 seconds: “sudo nano /live/image/syslinux/syslinux.cfg”
  9. INSTRUCTIONS HERE
  10. Make default booting option a persistent one “sudo nano /live/image/syslinux/live.cfg”
  11. INSTRUCTIONS HERE
  12. Add some password for minimal security: “sudo passwd root” and “sudo passwd user”
  13. Find the hard disks designations (in my case all partitions were NTFS): “sudo fdisk -l | grep NTFS” and add them into /etc/fstabs: “/dev/sda1 /mnt/windows ntfs-3g defaults 0 0” to have them mounted on startup.
  14. To have disks spin down if idle edit /etc/hdparm.conf: “/dev/sda { spindown_time = 120 }”
  15. Configure samba, to have it share the disks within your network. See this

The result should be a USB stick which boots up a nice light debian system, shares your files accross the LAN and is easy to maintain if you have basic Linux knowledge.
I might improve the power consumption my setup in the future by replacing the old computer with a Raspberry Pi to make the whole thing much smaller and economical (supposedly it only consumes ~5W).