Tag: HP Microserver

A while ago I bought myself a HP Microserver – a cheap, low power box which has four 3.5″ drive bays and an optical drive bay. I bought it to run as a home server which would back up all my data as well as serve up video, music and photos around the house. I had decided before buying that I wanted to store my data using the ZFS filesystem since ZFS was the only filesystem at the time which offered guaranteed data integrity. (It still is the only filesystem of release quality which offers this, although BTRFS is catching up.) I have become almost obsessed with ZFS because of the overwhelming benefits it offers but I won’t go into them here. Instead I recommend watching this talk by the creators of ZFS (Part 1, part 2, part 3) or read through the accompanying slides. [PDF]

I meant at the time to write about how I set up my system but never did get around to it, so here is what I did in the end. The server arrived with 2GB of ECC RAM and a 250GB hard disk. I eventually upgraded this to 8GB RAM and added two 2TB hard disks, although I started with one 2TB disk and added the second as a mirror when finances allowed. ZFS checks the integrity of the stored data through checksums and so it can always tell you when there is data corruption but it can only silently heal the problem if it has either a mirror or a RAID-Z/Z2 (Equivalent to RAID 5 or 6.)

ZFS is available as part of FreeNAS, FreeBSD, Solaris, and a number of Solaris derivatives. I initially installed FreeNAS 8. FreeNAS runs from a USB stick which I put in the handy internal USB socket, but while that was great for storing and sharing files it was not so good for running bittorrent on or using SSH to connect from out of the house. I also tried Solaris but I ended up going back to what I know and using Ubuntu Linux 12.04 LTS. Although licensing prevents ZFS from being included with Linux it is trivial to add it yourself.

I have assumed a certain level of knowledge on the reader’s part. If it doesn’t make much sense to you then you might be better off with FreeNAS or an off-the-shelf NAS box.

After installing Ubuntu and fully updating it I did the following:

sudo add-apt-repository ppa:zfs-native/stable

sudo apt-get update

sudo apt-get install ubuntu-zfs

…and that was it. It is a lot more complicated to use ZFS as your root filesystem on Linux, so I don’t.

Update: as of Ubuntu 16.04 ZFS will be supported directly. You will be able to install ZFS with the following rather than adding a third-party repository:

sudo apt-get install zfsutils-linux

Next, I had to set up the ZFS storage pool. The creators of ZFS on Linux recommend that you use disk names starting with /dev/disk/by-id/ rather than /dev/sda, /dev/sdb etc as they are more consistent (particularly the wwn identifier) so look in that folder to see what disk names you have.

ls -l /dev/disk/by-id/

The example pool name given is tank but I strongly recommend that you use something else. To create a single disk storage pool with no mirror:

I prefer to use mirrors as they are generally faster, however if you want a RAID5-type setup use:

sudo zpool create tank raidz1 … … … (3 or more disk identifiers)

The system will create your storage pool, create a filesystem of the same name and automatically mount it, in this case under /tank.

“sudo zpool list” will show you that a pool has been created as well as the raw space in the pool and the space available.

“sudo zpool status” will show you the disks that make up the pool.

While you can just start storing data in your newly-created filesystem (in /tank in our example) that isn’t the best way to use ZFS. Instead you should create additional filesystems within your storage pool to hold different types of data. This will allow you to do things like set compression, deduplication, quotas and snapshots differently for each set of data or backup an individual filesystem with zfs send. You use the zfs command to create your filesystems. Some examples:

sudo zfs create tank/music

sudo zfs create tank/videos

sudo zfs create tank/backups

The above examples will create filesystems in the pool and will automatically mount them as subfolders of the main filesystem. Note that the name is in the format pool / filesystem name and there is no leading slash on the pool name.

Check that your filesystems have been created:

sudo zfs list

Now we need to share the data, otherwise it’s not much of a server. ZFS will automatically manage sharing through NFS (Unix/Linux) or SMB (Windows) but you must first install the server software. For sharing to Windows clients use:

sudo apt-get install samba

To add NFS use:

sudo apt-get install nfs-kernel-server

You don’t need to configure much because ZFS handles most settings for you, but you might wish to change the workgroup name for Samba in /etc/samba/smb.conf.

To share a ZFS filesystem you change a property using the zfs command. For Windows clients:

sudo zfs set sharesmb=on tank/music

sudo zfs set sharesmb=on tank/videos

For Unix / Linux clients:

sudo zfs set sharenfs=on tank/backups

Or you can share the whole lot at once by sharing the main pool. The sub-filesystems will inherit the sharing property unless you turn them off:

sudo zfs set sharesmb=on tank

sudo zfs set sharesmb=off tank/music

You can check whether your filesystems are shared or not:

sudo zfs get sharesmb,sharenfs

At this point you should be able to see your shares from other computers on the network but you probably won’t have permission to access them. You will need to ensure that the file permissions and owners are set correctly, and you will also have to add an account and set a password for use when connecting through Samba. If your username is ella then use:

sudo smbpasswd -a ella

to set your Samba password, and make sure that ella has permission to access all the files in your shared folders:

sudo chown -R ella:ella /tank/videos

Other useful features of ZFS that you should look up include snapshots and zfs send/recieve. I hope this short guide has been helpful if you are trying to set up a ZFS server. Let me know in the comments.

Updated 29/02/2016 to remove some personal details, add information about ZFS support in Ubuntu and add some explanations noted in the comments.

There are a few computers in our house. I have a PC on my desk. I have another PC connected to the TV which we use for watching and recording TV, films, music, and playing games. I have a netbook in the bedroom for those days when I can’t get out of bed, and an Android phone which I use for music and video too. My wife has a laptop and an Android tablet computer.Keeping track of our files on all of that can be a bit chaotic and so I have an old PC which works as a file server – a central repository for all of our music and video files which all of the other devices can fetch files from.

That file server consists of an old under-powered PC which runs FreeNAS and has a couple of not-quite-worn-out laptop disks in it because those were all that I had. Since this server isn’t very fast or reliable, Last week I bought a 2TB hard disk to replace the dying disks. I also had an email from ebuyer (my normal source of computer parts) which featured a HP Microserver for £229 with an offer of £100 cashback from HP. A new server capable of running four disks with low power consumption and a warranty all for £129 seemed like a fantastic deal to me, so yesterday I bought one. (It had gone up by £10 though.) The server came with a 250GB hard disk which is a bonus since hard disks are still very expensive after flooding in Thailand destroyed several factories recently.

I intend to use the new server to hold all our music and video as before, plus our photographs. I will store all my files and documents on it, and I will backup the other computers to it. Now that I have my new server I have to work out what operating system I am going to run on it. My old server has FreeNAS installed onto a 2GB USB memory stick, and the hard disks are formatted with ZFS for high file integrity. I could do the same with my new server but since the new server is a bit more powerful (Dual-core CPU, 6GB RAM) I want to also run a couple of Linux virtual machines on it and I can’t easily run virtual machines with FreeNAS as the host operating system. I don’t want to run a file server from a virtual disk either, to avoid any data loss. Oracle Solaris has ZFS so I could run that on the new server and then run VirtualBox on that to host my Linux VMs. Another option is to run a bare metal hypervisor like VMWare ESXi or Citrix Xenserver, and then run Linux and FreeNAS as clients under that. I still wouldn’t want to serve my files from a virtual disk but I could give the FreeNAS virtual machine direct access to the 2TB hard disk. The only question then is where the virtual machines reside. I would prefer not to use the 250GB disk as that would be a welcome upgrade in my Media Centre PC which currently has a horrifically slow IDE disk which struggles to record two programmes at once. I could possibly host the virtual machine for FreeNAS on a USB memory stick too, maybe even the same one as ESXi is installed on although I don’t know if that can be done. I am curious as to whether ESXi could load a second virtual machine through an iSCSI drive served up by another one of it’s clients but that does seem like a recipe for slow operation and data loss.