Zfs sanity test


I posted about an out-of-memory problem with btrfs:
http://barryk.org/news/?viewDetailed=00453

I decided to try zfs. Followed these instructions to compile the 4.8.7 kernel with zfs built-in. The utilities, such as 'zpool' and 'zfs' are also compiled and installed:
http://www.linuxquestions.org/questions/linux-from-scratch-13/%5Bhow-to%5D-add-zfs-to-the-linux-kernel-4175514510/

I am running Quirky 8.x x86_64, zfs requires a 64-bit system.

As I know virtually nothing about how to use zfs, some hand-holding is needed. Followed these instructions to setup zfs on a USB flash stick:
http://serverfault.com/questions/736805/zfs-on-a-single-external-hdd-drive-setup-tutorial-and-workflow

In my case, the second partition of the flash stick is /dev/sdd2 and is about 29GB, the same one used for earlier btrfs test. From the above link, this is what I did:

# zpool create -f quirkypool /dev/sdd2
# zfs create quirkypool/bk
# zfs set compression=off quirkypool/bk
# zfs set copies=2 quirkypool/bk


After which I discovered a top-level folder '/quirkypool', mounted as a zfs filesystem.

Then the big moment, copied all of Quirky into it:

# cp -a /path/to/quirky/files/* /quirkypool/bk/

...and it copied, no problem at all.

Due to the "copies=2" it is expected the used space to be about twice the size of the files, and that is the case.

# du -m /path/to/quirky/files
1562
# df -m
quirkypool/bk 27776 3182 24594 12% /quirkypool/bk
# du -m /quirkypool/bk
3190


Yay, now I should try with compression!


Comments:

Zfs needs initramfs   Posted on 15 Nov 2016, 22:03 by admin
It doesn't seem possible to boot into a zfs drive/partition directly, without an initramfs.

Even with an initramfs, my brief reading indicates it is messy. Apparently it needs a copy of the exact same /etc/zfs/zpool.cache in the initramfs as in the main f.s.

Btrfs shows its superior integration with the kernel here, with easy kernel boot parameters to boot directly without needing an initramfs.

So, have decided to put zfs on the back burner.


zfs export import   Posted on 15 Nov 2016, 18:32 by admin
Some extra usage notes.

The setup that I have already done is stored in /etc/zfs/zpool.cache

To access the zfs partition after a reboot, seems need to do this (now have name 'qpool' instead of 'quirkypool'):

# umount /qpool/bk
# umount /qpool
# zpool export qpool


The after a reboot:

# zpool import qpool
# zpool list
NAME SIZE ALLOC FREE EXPANDSZ FRAG CAP DEDUP HEALTH ALTROOT
qpool 28G 1.40G 26.6G - 1% 4% 1.00x ONLINE -


Of course, my original use of /dev/sdd2 is not good for a removable drive. There are alternatives for specifying an unchanging partition name.


Zfs test with lz4   Posted on 15 Nov 2016, 17:38 by admin
I tried with lz4 compression:

# du -m /quirkypool/bk
1441
# df -m
qpool/bk 27776 1433 26344 6% /qpool/bk


Very good!