Setting up a NAS server with Tiny Core Linux 5.4

Makes sense, since the whole OS runs from a USB key, no need to waste hard drive space for an OS to do the few things I want a NAS to do, namely mount my existing NTFS drives (2 data drives, 2 backup drives), share the data drives on my LAN via samba and run a few rsync jobs to keep the backup drives in sync with the data drives.

I could have used (and considered) NAS4free but I want to keep my data on NTFS drives (because if the machine fails, I can pick up the drives, mount them in an external USB enclosure and access my data from any machine I have lying around) and NTFS works in nearly everything. Problem with NAS4Free from that prospective is that NTFS is not recommended. I tried it and was able to mount and share my drives fine but running rsync just blew up the box and triggered a reboot.

I have already covered most of the work in a previous post, copying the Tiny Core Linux ISO to a USB key, installing it and setting up SSH.

After that, type “blkid” in the terminal to view which disks are available to be mounted, install ntfs-3g and mount the drives with the command “sudo ntfs-3g /dev/sde1 /mnt/data1”. I decided to add to the /opt/bootlocal.sh file the commands to create a /shares folder, then subfolders for each drive as well as the mount commands for each drive. Do not put those into the /home folder (as I did inadvertently the first time around) because then your data will be backed up and fill your USB drive and RAM to capacity (when you hit that issue by the way, just plug your USB into a Linux box, explode the mydata.tgz file, remove the folder and boot from the USB again)!

Samba again is covered in my previous post. Next on my list is rsync, FTP access and web utilities…

Rsync is pretty straightforward, install the rsync.tcz package and run the backup commands from /opt/bootlocal.sh. The FTP package is bftpd.tcz and the config file is /usr/local/etc/bftpd.conf. I just tweaked the settings to allow root access and set the default home directory to /usr/local/apache2/htdocs (since I only want FTP access to maintain my web files). Install the apache2.tcz and apache2-mod-php5.tcz for web access and php support.

Now I was looking for a web interface to display info on the drives (space, temperature…) and phpsysinfo fits the bill perfectly. Now to get smart info, I had to install the smartmontools.tcz package and because phpsysinfo doesn’t seem to be able to run the smartctl command with enough rights, enable cron in the boot options to run smartctl as a cron job and output to a text file that phpsysinfo can then read.

As an added bonus, I installed MiniGal Nano to display all my home pics through a web interface. I had to fight with the apache-mod-php5 package to be able to enable the gd library, for which I had to install the XLibs.tcz, gt2k.tcz, libiconv.tcz and libpng.tcz. Now the version of the libpng library bundled with the 5.x version doesn’t match the version required by apache-mod-php5 and I had to (from another computer) replace the libpng.tcz with the one from version 4.x (which I downloaded from http://ftp.vim.org/ibiblio/distributions/tinycorelinux/4.x/x86/tcz/libpng.tcz). But I got it working in the end and it was worth the trouble shooting! And to top it up, a nice landing page using the Deep template.

Advertisements