Old Vista Laptop Into A Linux ZFS File Server
You might be surprised at how much potential for usefulness still remains in older equipment.
My wife’s old laptop originally booted with Windows Vista, which (apart from being a generally substandard OS – Microsoft employees ran into so many problems with it, they reportedly didn’t even use it internally*) is no longer supported*(2). Mainstream support for Vista ended back in 2012, and as of April 11 2017, Vista will be officially dead.*(3)
The laptop itself is a Dell Inspiron 1525, with a single-core 64-bit Celeron CPU that was bought around 2008. It has an HDMI video-out port, 2GB RAM, a DVD burner, and originally came with a 160GB laptop SATA drive.
More info on the laptop specs here: https://en.wikipedia.org/wiki/Dell_Inspiron_1525
The main limitations of this laptop are the 2.13GHz single CPU core and the 100Mbit Ethernet port. But it still has quite a bit of life left in it, thanks to Linux and a few accessories.
With a few bits of hardware I had lying around or bought for the purpose, I was able to increase the laptop’s network speed significantly and enable extra disk storage by using these two items:
1) (~$14.75) Plugable USB 3.0 to Gigabit Ethernet Network Adapter (ASIX AX88179 chipset)
2) (~$58.00) 2 Port SATA 6 Gbps ExpressCard eSATA Controller Card (ECESAT32)
My ZFS 4-disk pool file transfer speed went from ~12MB/sec over my Gigabit home network to ~30MB/sec sustained (transferring files with tar over netcat) with this one simple change!
I also replaced the laptop’s aging 160GB SATA hard drive with a 120GB SSD drive that I had leftover from a previous project, which made boot speed and the system in general MUCH faster.
3) SSD laptop drive: KINGSTON SSDNOW SH103S3120G
Nearest equivalent: (~$50.99) Kingston Digital 120GB SSDNow UV400 SATA 3 2.5″ SUV400S37/120G
To make a fairly spacious and redundant ZFS fileserver, I decided to use my existing 4-bay Probox:
(~$99.99) Mediasonic ProBox HF2-SU3S2 4 Bay 3.5” SATA HDD Enclosure – USB 3.0 & eSATA
Some nice things about the Probox: It includes all necessary cables, supports up to (4) 5.25” SATA hard drives (NAS type drives recommended – I used Western Digital 1-2TB Red drives for lowest budget, although they are slower; I can also recommend Seagate 2TB NAS drives for budget and speed; both models are under $100/each) and it has a selectable eSATA and USB3 cable connection. USB3 on Linux has limitations — if disks are swapped out, drive assignments can change; also you lose SMART disk status and testing ability — so I set the Probox to use eSATA.
So if you had one of these laptops (or similar) and wanted to closely replicate my project (before filling the Probox with drives), your cash layout as of this writing would be about $173 plus tax, without the SSD drive. Now you can buy a basic Dell Inspiron 3000 laptop for around $130-150, or a 4-bay diskless QNAP or Synology NAS for around $280-$300 – BUT that’s not the point.
If you’re at all like me, you probably have some stuff lying around the house and would like to get further use out of your investment without relegating it to the trash or giving it away. This article is for you. Using a pre-existing piece of equipment and making it into something useful also gives me something to do in my free time while searching for a new Linux-related job, as well as rewarding me with a sense of accomplishment when I get it working as desired. And I will also mention that the above equipment is Optional. If your existing hard drive is still working fine after almost 9 years and you don’t need the best network speed, you can still go forward with what you have. In addition, you should be able to adapt these instructions to something other than a random Dell laptop.
The nice thing about having the extra equipment, however, is that it can be used for other projects as well. (I have several of the USB3 Gigabit Ethernet adapters and have also recommended them to friends.) Although the USB3 Ethernet adapter is limited to USB2 speeds for this project by using an eSATA card instead of a 2-port USB3 card, it’s still far better than the stock 100Mbit Ethernet.
The ZFS filesystem allows you a certain amount of flexibility, by the way. You don’t need to create a single ~1.8TB zRAID10 pool using all four drives – with the Probox, you could have (2) separate pools with 2 drives each if you wanted – but each pool’s size would be limited to the drive size in that case. Stepping up to 4TB NAS drives would make sense – however, they still cost ~$130/each at this time, and this is a “limited budget” project.
But getting on with the details… A critical step before installing the SSD was first making a copy of the Dell utility partition so I could still access the BIOS. I was able to do this by booting System Rescue CD*(4) and copying the 160GB drive’s first partition with DD to a USB thumbdrive I had lying about.
Command used in SystemrescueCD to backup the Dell partition:
dd if=/dev/sda1 of=/mnt/thumb/sda1-dell-utility-partition.dd bs=1M
Switching to a low-cost SSD had a number of benefits (besides speed) – less power usage, fewer moving parts, and less heat.
One of the good things about the “ZFS way” is that it simplifies things like Logical Volume Management (LVM) and RAID into a more manageable methodology, while providing end-to-end data protection – plus easy snapshots. ZFS also makes file-sharing your data with Windows machines dead simple by using Samba.
If budget is a real issue (say, you get paid once every couple of weeks), you can literally start off with (1) ZFS hard drive, do a burn-in test to make sure the drive doesn’t fail early, and start putting data on it; then add a mirror drive later – when you can afford it – for RAID1 redundancy. ZFS will copy the drive’s data in real-time and you can still access your files, albeit with something of a performance penalty. Once it’s done “resilvering” though, your read speeds should improve because ZFS can now pull the data from both spinning platters.
Now say it’s two weeks later, and you can afford to buy your 3rd drive (Important note: All drives in a given ZFS pool should be of the same manufacture, model, and capacity) – you get it shipped to your house, put it through a burn-in test, and then you can let it sit for a couple of weeks until you buy the 4th and final drive. Pop those into the Probox enclosure and you can expand your ZFS pool on-the-fly to a 4-drive RAID10. (Yes, I have done this. Yes, it actually works.)
Moving on… After replacing the laptop’s hard drive with the SSD, I again booted System Rescue CD and recreated the Dell utility partition with ‘ fdisk ‘ (you need to use fdisk to change the Partition type to “de”) and then used ‘ gparted ‘ for the rest of the layout. Note: run ‘ startx ‘ before doing gparted.
SSD Drive layout (fdisk -l):
Disk /dev/sda: 120 GB, 120031511040 bytes 255 heads, 63 sectors/track, 14593 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sda1 1 6 48163 de Dell Utility /dev/sda2 * 6 1572 12578895 83 Linux /dev/sda3 1572 3139 12586927 83 Linux /dev/sda4 3139 14594 92012287 5 Extended /dev/sda5 3139 3330 1534207 82 Linux swap /dev/sda6 3330 3591 2096482 83 Linux /dev/sda7 3592 14594 88373565 83 Linux ## Put the Dell “de” partition data back on the SSD # dd if=/mnt/thumb/sda1-dell-utility-partition.dd of=/dev/sda1 bs=1M
/dev/sda1: SEC_TYPE="msdos" LABEL="DellUtility" UUID="3030-3030" TYPE="vfat" /dev/sda2: UUID="93fce241-xxx-cb6f1b01aee3" TYPE="ext4" /dev/sda3: LABEL="rootantiX-16" TYPE="ext4" /dev/sda5: LABEL="ssdswap" TYPE="swap" /dev/sda6: LABEL="ssdhome" TYPE="ext4" /dev/sda7: LABEL="ssdextra" TYPE="ext4"
After copying the Dell utility partition data back to the SSD, I downloaded and installed
” lubuntu-14.04.5-desktop-amd64.iso ” (*5) to /dev/sda2 and used a separate partition for /home.
For the curious, the laptop dual-boots with AntiX MX-16 on sda3 and is using the same swap and /home (sda6). The extra space on sda7 is used as /mnt/extra; it’s for storing ISOs, music, movies and backups. That’s another nice thing about using a general-purpose laptop for a project like this — the primary use that it’s been put to is actually as a DVD player.
If you are new to Linux and ZFS, I highly recommend starting with Ubuntu 14.04 LTS instead of the newer 16.04. In my experience, 14.04 is very stable and not very prone to unexpected behavior. The Xubuntu or Lubuntu flavors are fairly light on resources and leave quite a bit of room for ZFS caching if you have at least 2GB of RAM.
An important note: DON’T try to use this setup (laptop + Probox) in a “production” environment(!)
It’s OK for home use/light usage, demos, testing, and learning more – but get a real server going if you expect reliability.
If you need a 4-port SATA3 PCIe card and don’t want to delve into SAS, I can recommend this one since it has port multiplier, will work with the Probox, and delivers much better disk speed:
(~$50) Vantec 4-Channel 6-Port SATA 6Gb/s PCIe Card (UGT-ST644R)
(~$7) ESATA TO SATA Cable male to male M/M Shielded 6Gbps [sic]
^^ Use something like this cable if you want to connect the PCIe card’s Internal port to the Probox
Some PROTIPs / Best Practices for ZFS on Linux:
1) Don’t enable de-duplication on ZFS. Use compression=lz4 instead.
2) DO: Use the equivalent of zRAID10 (mirrored pairs), not raidz/raidz2/raidz3. You will thank me when it’s time to replace a failed drive! Rebuild times for a RAIDZ can be significantly longer than you might expect. In addition, it’s my considered opinion that any drive of 1TB or over should have at least 1 mirror. With ZFS, you can even do triple-mirroring if you like: (1 drive +2 mirrors)
3) DO: USE ZFS SNAPSHOTS. Seriously. (Caveat: you will need to delete snapshots occasionally to free up disk space if you move files/directories around or delete them entirely.)
zfs snapshot -r zfspool/dataset@description-currentdate
4) DO: Burn-in Read/Write test all of your new drives before allocating them to a ZFS pool.
This is one of the most important things to remember!
time badblocks -f -c 10240 -n -s -v /dev/sdX
## ^^ ONLY run this command on new or “blank” drives – I take no responsibility if you run it by mistake on your boot drive! (Also note this can take hours to finish, especially for larger drives)
5) DO: Use GPT partitions on your ZFS drives, not “msdos” type partitions.
Also, allocate the entire drive to ZFS – don’t use partitions like you might with LVM.
parted -s /dev/sdX mklabel gpt
## NOTE data loss if used incorrectly! Only use to initialize a new drive as this will overwrite / re-partition the entire drive!
6) DO: Use /dev/disk/by-id when creating your ZFS pools, not /dev/sda naming.
7) DO: Always create your pools using ‘ ashift=12 ‘ for spinning hard drives, regardless if they have 512 sector sizes or 4K sectors. This will save you massive amounts of hassle.
8) DO: Use ‘ atime=off ‘ everywhere, unless you really need it. (Equivalent of “noatime” in fstab)
9) DON’T: make an unbalanced RAID10 (3 drives == 2x mirrored, 1x non-mirrored) mirror it ASAP!
10) DON’T: If using a RAID-capable card to connect your drives, don’t use it in RAID mode – use “JBOD” mode or “just a bunch of disks” to configure your ZFS pool.
Guideline: More RAM is almost always better. But if you’re in a “low budget” situation, you can achieve “usable” ZFS experiences with as little as 2GB RAM if you are willing to sacrifice some conveniences (like GUI and speed.)
Next Upcoming Article – Part 2: Putting it All Together