Sep 23 2014

New personal NAS / Home Server!

I recently (through work) found a great deal on a sweet NAS array (a Thecus N7700 Pro loaded with hard drives) but being the hacker I am, I didn’t stop there.I quickly discovered via popping the thing open and doing some digging online that it’s really just a small PC (Core 2 Duo 1.6ghz, 4GB ram, and a proprietary 128MB IDE flash module with a 7 disk SATA controller) that runs linux and does linux software raid.  Sadly the Thecus software that runs on this thing by default is horribly limited (it’s really JUST a NAS, no more, no less) but noting that it’s mostly commodity hardware, I decided to grab a reasonably quick USB flash drive that doesn’t protrude (and thus won’t be unplugged easily from the back of the unit as it’s the “permanent” system drive), and use virtualbox to install ubuntu server on it to configure it any which way I please.  I noticed that there are holes/solder points to install a VGA jack on the motherboard so I decided to hack apart a vga cable, plug it in, and see if it worked and lo and behold, I got standard video from the onboard graphics device.  it uses a standard bios so i then plugged in a keyboard, my new usb system disk, and proceeded to boot the thing from usb, and it came up like a champ.  When I bought this NAS array from work, it came populated with 7x western digital 3tb 5400rpm “Green” drives and a warning from my boss that the array had been flakey (and really no longer needed due to our storage needs at work now being taken care of by proper big metal).  I painstakingly did a full surface scan and long test on each of the drives and found that 2 of them were bad so I removed them and recycled them leaving 5 drives that passed my extensive extended testing.  once i removed the bad disks, I set out to to do some more reading about big filesystems (from the advanced btrfs and zfs to the more classic ext3/4, xfs, jfs, etc.), linux raid, and linux’s Logical Volume Manager (LVM) and decided that for my needs I’d configure a 5 disk raid 5, (md0), and use LVM as an intermediary in case i want to extend my filesystem over multiple arrays (if i add other disks or chose to replace only a couple with different sized disks, etc, to give me later options). which gave me 12tb of storage to work with.  due to the limited memory available on the machine (and less support under linux compared to bsd), I opted NOT to use ZFS, and btrfs raid5/6 is currently being tested with unlikely damage recovery if something bad were to happen, so I was left with 3 popular, well-tested options: ext4, XFS, and JFS.  due to ext4 and xfs being incredibly more popular than jfs, i gravitated to those 2, and upon reading that redhat moved to XFS a while ago, and it seems a bit more stable (especially for a large number of small files, media, etc.) it seemed like the best choice. so all in all I ended up with an 11TB XFS partition on my LVM logical volume made of my 12TB RAID volume made of 5x 3tb disks.  As I knew I would be using this as a backup and media storage array, the first thing I did was add xfs_fsr (xfs filesystem reorganizer, which does some error checking and defragmentation) to my crontab scheduler, and then as the system is pretty slow, low on ram, and flash drives have a very limited number of writes they can accommodate, I added /dev/raid/raid to my fstab so it would be mounted on boot, coppied /var to /raid/var and told fstab to mount /var on /raid/var so that logs, databases, and all other variable content that gets stored on the system would be both *much* faster to read and write, and be protected by raid in case something bad happened.  I decided that I wanted to set a static ip rather than using my router’s dhcp (so I always know what the ip is), set it’s hostname, etc. and for my own convenience, set up webmin, sshd, samba, storage directories, installed plex media server to transcode and stream media content to my xbox 360 or my laptop over the internet wherever i may be (works great so long as i stick to only 1 stream, the cpu isn’t quite strong enough to do more than that), Transmission-daemon to act as a seed box for downloading ISOs, home made movies, etc. and bittorrent sync to act as my “personal dropbox” between my home workstation, phone, notebook, etc.  it works great and everything says in sync that I want to. and then I set about backing up my notebook, workstation, and phone via samba to my new array…  so far it’s been working like a champ.  a full-on linux home server from something that the company wanted to be JUST a NAS.  worked out great!

Leave a Reply