NAS II - Shuttle

I was using a TS-201 QNAP NAS to store all my data. This little device runs an enbedded linux and not only acts as a NAS but a BitTorrent Download station and a DLNA Media Server to stream content to my PS3. It really is a cool bit of kit.

The only problem is, once you have seen what it can do you want more! A whole group for modding the TS-201 has sprang up. The QNAP download station was pretty basic, so I loaded a BitTornado client and wrote a custom PHP front end. But with only a cut down OS and small internal memory there were limits to how much you could customise the TS-201. Added to this QNAP have not released an official firmware for over a year. I am currently running a Beta because this is the only one that supports the PS3 over DLNA.

Since the QNAP was just using Linux I thought I would take the 500Gb disks out of the TS-201 NAS and put them in my unused SK22G2 Shuttle and install Linux. With a full OS and 500Mb of RAM there are no limits on what I can load onto it!


I removed all the PCI cards, and took out the DVD drive. I installed CentOS 5.1 from an external USB DVD drive. The plan is to keep the power consumption and heat down in the NAS. To help with cooling I mounted the second disk drive in the 5.25 DVD bay using some brackets.

The stripped down spec looked like this:

  • Shuttle form factor, proprietary design VIA K8M890CE + VIA VT8237R+ chipset Motherboard

  • Althlon AMD Socket AM2 XP3500+

  • 512Gb DDR RAM

  • 500Gb ST3500630AS

  • 500Gb ST3500630AS

    Building a custom NAS:

  • Install CentOS

  • Configuring Samba

  • DLNA Media Server

  • Mencoder

  • BitTornado


    Install CentOS 5.1

    To install using software RAID you need to install CentOS using the graphical install program. The text install did not let me create a Volume Group for LVM. Its a little tricky to configure RAID but once you get your head round it things start to take shape.

    After the install the file system layout looks like this:

    
    [root@vader ~]# df -k
    
    Filesystem           			1K-blocks	Used		Available	Use%	Mounted on
    /dev/mapper/VolGroupSW01-LogVol01	5427652		1286960		3860528		26%	/
    /dev/mapper/VolGroupSW01-LogVol02	10158648	211080		9423280		3%	/var
    /dev/mapper/VolGroupSW01-LogVol03	455366520	248766500	187796432	57%	/data
    /dev/md0                		101018		11740		84062		13%	/boot
    tmpfs					224740		0		224740		0%	/dev/shm
    

    The plan is to put all my data on LogVol03 which is mounted on /data.

    These Logical volumes can easily be resized: Resizing RAID Logical Volumes.

    The Logical Volumes are on top of RAID1 giving data redundancy: How to recover a RAID disk.

    I chose the server version of CentOS because this will be a headless Linux server. But even using custom selection of packages a lot of junk is installed. For example bluetooth drivers! It just needs a bit of effort disabling unused services and removing packages that are not required.


    Configuring Samba

    I used samba to share drives with windows desktop machines:

    
    [root@vader ~]# cat /etc//samba/smb.conf
    
    [global]
            workgroup = SKYNET
            server string = VADAR NAS
            netbios name = VADER
    
            security = user
            passdb backend = tdbsam
    
    [steve]
            comment = Steve
            path = /data/steve/
            read only = no
            guest ok = no
    
    [vader]
            comment = Vader
            path = /data/vader/
            read only = no
            guest ok = no
    
    [video]
            comment = Video
            path = /data/video/
            read only = no
            guest ok = no
    

    All that is left is to add a samba user. If you use the same username and passowrd as your windows machine, windows will connect without prompting for user credentials.

    
    [root@vader ~]# smbpasswd –a swatts
    	New SMB password: ********
    	Retype new SMB password:********
    

    DLNA Media Server

    I looked at a few Media Servers for the new NAS. MediaTomb had a few good write ups and apparently a good GUI. Obviously whoever wrote this report has no idea what a good GUI should look like. MediaTomb GUI is terrible, and once again lack of good documentation lets another Open Source project down.

    Fuppes is another free Media Server. I downloaded and ran it on Windows where it managed to transcode the WMV files to MPEG2 on the fly so the PS3 could view them. Unfortunately it was a different story on Linux. After struggling to compile Fuppes with ffmpeg it would not transcode any content. So for a time I used it just as a simple Media Server and it worked fine. But then it started segmentation faulting on me. I assume it could not handle one of the filenames in the media library. You get what you pay for.

    This all led me back to Twonky Media Server which I used on the QNAP TS-201 NAS. I loaded the eval of this on and it worked fine. Also shows me how out of date the Twonky Media server was on the TS-201 and highlights the failings of QNAPs policy of no updates for a year!


    Mencoder Video Encoding

    Memcoder is a multi purpose encoder for Linux and part of the mplayer suite. Since the NAS has the same horse power as my desktop I can offload DVD and other encodes to the NAS. Here's an example of two pass DivX Encoding.

    Pass 1. This will give you an indication of bitrate to use.

    
    mencoder -ovc xvid -xvidencopts profile=dxnhtntsc:pass=1:quant_type=mpeg:nopacked input.wmv -oac mp3lame  -o /dev/null
    

    Pass 2. Feed the bitrate parameter into the second pass -xvidencopts bitrate=x:

    
    mencoder -ovc xvid -xvidencopts quant_type=mpeg:pass=2:bitrate=1000:nopacked input.wmv -oac mp3lame -o output.avi
    

    Note the cryptic command line. Encoding video files is a total mine field! Steve'sGuide to encoding to DivX/Xvid.


    BitTornado

    For a headless BitTorrent download station that I can leave on 24x7 I downloaded the latest BitTornado code and updated my own PHP front end:

    The PHP front end executes btdownloadheadless.py which forks and downloads the torrent:

    
    HOME=/data/video/NEW/; export HOME; /data/vader/web/torrent/BitTornado/btdownloadheadless.py 
    /data/video/NEW/.transfers/_isoHunt__Angel___Complete_Season_4___DVD_Rip.torrent 
    --saveas "/data/video/NEW//incoming/Angel - Complete Season 4 - DVD Rip" --display_interval 1 
    --max_download_rate 0 --max_upload_rate 0 --max_uploads 4 --minport 49160 --maxport 49300 
    --rerequest_interval 1800  --super_seeder 0 --max_connections 40 | /data/vader/web/torrent/log.pl 
    /data/video/NEW/.transfers/_isoHunt__Angel___Complete_Season_4___DVD_Rip.torrent.stat 1> 
    /data/video/NEW/.transfers/_isoHunt__Angel___Complete_Season_4___DVD_Rip.torrent.error 2> 
    /data/video/NEW/.transfers/_isoHunt__Angel___Complete_Season_4___DVD_Rip.torrent.error & echo $!
    

    The hard part is dealing with btdownloadheadless.py status output. Every x seconds it echos the torrent status to stdin. I got round this by piping it to my perl program log.pl which reads the stdin and writes the latest info to a torrent.stat file.



    Vader NAS II.


    Back to Steve's tech pages


    Steve Watts Kirk Scott Hawes Signs Alprange Enterprise Solutions Hewlett Packard British Council Standard Chartered Bank SCB Wolseley Northampton Moulton Hull University Reading