Building NAStie
This covers the method I used to configure a home NAS (in a manner similar to My Home NAS) after I decided a Bufallo LinkStation Duo was not suitable. Why do it this way, rather than with a standard NAS solution?
-
To assuage my discomfort with "black box" solutions like the above-mentioned NAS.
-
To learn more about running software RAID and (possibly) volume management (whether that be vinum or LVM).
-
To have only those features I need enabled and installed.
-
To allow my wife and I to have a shared network storage, and network accessible storage for backups of both laptops.
Hardware
The base system will be an old Compaq SR1103WM with 768 MB of RAM and a 40 GB hard drive which was given to me. Replacing the 40 GB drive are two 1.5 TB hard drives and a SATA controller card. The controller is RAID capable, but I will not be using the RAID capability.
Procedure
-
Install Debian using software RAID1, with LVM on top (I installed lenny and upgraded to testing).
-
Configure the two hard drives as physical devices to be used in RAID.
-
Configure the LVM to use the entire RAID device (/dev/md0?).
- I created four logical volumes named boot (30GB), swap (1.5GB), reverse (400GB), and family (~1.1TB). The reverse volume is for backups, and the family volume is for shared family files.
-
Install some software using aptitude/apt-get, but first...
-
Configure apt not to install recommended and suggested packages.
// /etc/apt/apt.conf // Recommends are as of now still abused in many packages. APT::Install-Recommends "0"; APT::Install-Suggests "0";
-
Add the contrib and non-free packages to our list.
# /etc/apt/sources.list deb http://ftp.us.debian.org/debian/ testing main contrib non-free deb-src http://ftp.us.debian.org/debian/ testing main contrib non-free deb http://security.debian.org/ testing/updates main contrib non-free deb-src http://security.debian.org/ testing/updates main contrib non-free
-
Install
deborphan
and trim out the fat. ;) -
Configure Samba as required. My personal configuration includes having a system user for each user who will have access to the Samba shares (whether those shares are the personal backups or shared family files), and only two shares (one for shared files, another for the wife's backups).
-
I based my install on the Secure Read-Write File and Print Server page in the Samba HOWTO collection, and left out anything about printing. Also, miscellaneous inspiration and technical stuff came from The Unofficial Samba HOWTO.
-
Add users for those individuals who will be using the shares. I use the following command lines (none of my users will be using the shell).
# useradd -N -g staff -M -c "Full Name" -s /nonexistant username # smbpasswd -a username
-
Make sure you set proper permissions on the shared directories. I used the following command line for my shared file directory.
# chown username:staff /srv/family # chmod u=rwx,g=rwx,o-rwx /srv/family
-
As mentioned in a thread about rlimit_max on the samba mailing list, there is a warning about max number of processes when running testparm against the smb.conf file. As it is only a warning, I do not fix
/etc/security/limits.conf
. -
Configure the email to be delivered at my mail exchange - I don't want any local delivery.
-
This is a difficult decision to make. I usually like to use msmtp for pure forwarding and qmail for anything requiring a queue. I do not want to have a full blown MTA on this system. I do want a minimal queue to ensure connectivity outages do not cause a loss of mail.
-
Install some utilities.
-
My favorites include
sudo
(do things as the superuser) andgit
(pull in my versioned configuration files from the master repository).