The "Tux Server Project"

or "Roll-Your-Own" Network Attached Storage Device

By Michael Charrier
Posted on October 4, 2003
Jump to:

Setting up the Software

Creating the Software Array

Originally was going to set up a RAID-1 configuration for the system disk. Unfortunately, because /dev/hdb shares an IDE channel with the CD-RW drive, Redhat detects /dev/hdb as having a different configuration from the other drives. The BIOS on the motherboard sees the Cylinders/Heads/Sectors of all the hard drives correctly: 19485/16/63. RedHat sees all drives EXCEPT /dev/hdb as being 19485/16/63; for /dev/hdb RedHat sees the configuration as 1255/255/63. Trying to set up a RAID-1 on two hard drives with dissimilar geometries causes filesystem corruption on both hard drives as soon as you reboot the system. Even writing a logical partition table to /dev/hdc using fdisk to change the C/H/S to match /dev/hdb does not work.

After several unsuccessful attempts, it was decided to just create a RAID-5 array using hard drives c - h and leave the system partition unmirrored. It is easy enough to back up the configuration files to a CD-RW and reload the system if the system disk fails. The real concern is having a always-on file server for the household.

There are two ways to configure the RAID-5 array: manually or using mdadm.

1. Creating the RAID-5 manually:

Array disks are /dev/hdc, /dev/hdd, /dev/hde, /dev/hdf, /dev/hdg, /dev/hdh

Edit /etc/raidtab and add:

# This stanza sets up the RAID5 config for the shared file system
raiddev /dev/md0
raid-level 5
nr-raid-disks 6
nr-spare-disks 0
persistent-superblock 1
parity-algorithm left-symmetric
chunk-size 64
device /dev/hdc
raid-disk 0
device /dev/hdd
raid-disk 1
device /dev/hde
raid-disk 2
device /dev/hdf
raid-disk 3
device /dev/hdg
raid-disk 4
device /dev/hdh
raid-disk 5


mkraid /dev/md0

2. Creating the RAID-5 using mdadm:

mdadm -C /dev/md0 -l raid5 -n 6 /dev/hdc /dev/hdd /dev/hde /dev/hdf/dev/hdg/dev/hdh

Wait until the array creation process finishes. Next, create a filesystem on the array:

mkreiserfs /dev/md0

Create a mount point for the filesystem

mkdir /vault

Add the following line to /etc/fstab:

/dev/md0 /vault reiserfs defaults 1 0

Then mount the filesystem:

mount /vault

Setting up the Samba share

I won't go into the details of setting up a Samba share simply because there are many resources available. A great starting point is and, of course, the man pages that are included with Samba itself. Here is a copy of the /etc/samba/smb.conf file:

# Samba config file created using SWAT
# from Vault (
# Date: 2002/10/26 05:15:41

# Global parameters
workgroup = WORKGROUP
netbios name = VAULT
server string = Vault
encrypt passwords = Yes
local master = Yes
domain master = No
preferred master = no
os level = 0
obey pam restrictions = Yes
pam password change = Yes
passwd program = /usr/bin/passwd %u
passwd chat = *New*password* %n\n *Retype*new*password* %n\n *passwd:*all*authentication*tokens*updated*successfully*
unix password sync = Yes
log file = /var/log/samba/%m.log
max log size = 0
socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
dns proxy = No
printing = lprng

comment = Home Directories
valid users = %S
read only = No
create mask = 0664
directory mask = 0775
browseable = No

comment = All Printers
path = /var/spool/samba
printable = Yes
browseable = No

comment = Welcome to the Vault
admin users = Administrator
path = /vault
read only = No
create mask = 0664
directory mask = 0775
browseable = Yes

Note that the parameter encrypt passwords is set to Yes because some clients on my net work run Win2K or XP. Pre-Win2K clients require that this be set to No since the older clients do not encrypt their passwords.


This system has been running for over a year with absolutely no problems. The only down-time is a system reboot when a new version of the kernel is available. My wife is happy that her files are always available and that she can backup her laptop email to a safe place. No more hunting across several systems to find our most important files and backups. Our network of systems (Dual Athlon MP running Windows 2000, Athlon XP running Windows XP Pro, two IBM RS/6000s running AIX 5.1L, Sun Ultra 10 running Solaris 9, laptop running XP Home, and an Apple iBook running OS X 10.2.6) are all sharing files with each other via the Tux Server. It's nice to have a happy home network.