Ubuntu Server – setting up ZFS (part 1)

For a while I’ve wanted to learn about Linux, the way the OS works, what can be done with it, if it’s reasonable to change to it as my main operating system.

As well as dual booting Windows 7 and Ubuntu 12.04 on my laptop I thought I should try and set up my home server running a Linux distro. This way I’d be forced to learn my way around the command line, setting up a system to run smoothly without the need for much maintenance.

The things I wanted to try to set up were:

  • Some sort of NAS, with the option of mounting it as a samba drive over my internal network and using some sort of FTP that has to be secure when accessing the shares from outside of my home network.
  • I really want to give Owncloud a try. Not just as an alternative to Dropbox, but also as a central calendar and contact database. Over WebDAV that should be possible. I’ll have to get a basic Apache setup running to do this.
  • I’d like to try out the ZFS file system as I have no previous experience with it.
  • To have an openVPN server running at home would be nice when working abroad for longer periods of time (tunneling email, accessing home network, …)
  • Maybe a Socks proxy (?)
  • Keeping it all secure

As I have some experience with Ubuntu desktop I picked Ubuntu Server to start with. As I go along setting up the system I might end up deciding to pick something else and start over, but as I take this as a learning experience that’s fine.

So I started downloading the Ubuntu Server 12.04 AMD64 iso and made a bootable USB stick to install the system.

During the installation I didn’t change much from the standard settings. I partitioned the disk before installing the OS but nothing else. As I knew I was going to need the Apache and MySQL packages for Owncloud I picked the LAMP bundle for installation as well.

After installation one of the first things to do was to get a zfs pool up and running. I had picked two Western Digital RED series 2 TB disks as my data disks as they are made to be running for extended periods of time and one Seagate Spinpoint 320 GB 2.5″ drive for the OS and swap. This should give me a good balance between power and storage. The 2.5″ will be set up to go into idle really quick to save power.

Installing Ubuntu ZFS

To install the ubuntu-zfs package the ppa:zfs-native/stable repository needs tot be added to the system.

Apparently the add-apt-repository command wasn’t installed yet on the 64 bit version on my system. There are two options:

  1. Install the python-software-properties package
  2. manually add the repositories to /etc/apt/sources.list

As I will need to add more ppa’s later on I chose the first option.

A quick sudo apt-get install ubuntu-zfs and some 170 Meg later the package was build and installed.

Creating a ZFS pool

sudo parted followed by print devices displays a list of devices with their storage capacity:

(parted) print devices
/dev/sda (320GB)
/dev/sdb (2000GB)
/dev/sdc (2000GB)

/dev/sdb and /dev/sdc are my two disks that will be used for a mirrored ZFS pool.

sudo zpool create zfs mirror /dev/sdb /dev/sdc creates a mirrored pool named zfs using the two disks in a mirrored configuration. Instead of residing in the /media or /mount directory, it can be found in the root of the file system.

sudo zpool list confirms that the pool exists:

NAME   SIZE  ALLOC   FREE    CAP  DEDUP  HEALTH  ALTROOT
zfs   1.81T   496K  1.81T     0%  1.00x  ONLINE  –

The next step will be to test the pool, writing data to it, unplugging one of the disks, formatting it, adding it to the pool again and check if everything works as fine as it should.

Before doing that I’ll set up a samba share on the zfs directory. This will provide me with a real-world situation where I can access the pool from another computer in my network.

Advertisement

2 thoughts on “Ubuntu Server – setting up ZFS (part 1)

  1. Interesting, there are some more useful tips in there as well.
    No information as to why it’s better to refer to the disks by ID’s than by name, so I’ll have to look into that. Thanks for the link!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s