zpool upgrade to get lz4_compress

FreeBSD now has zl4 compression for ZFS. But you must upgrade your pools to get it. If you try before upgrading, you’ll get:

# zfs create -o recordsize=8k -o primarycache=metadata -o compress=lz4 system/usr/home/dan/pgsqlsql
cannot create 'system/usr/home/dan/pgsql': pool must be upgraded to set this property or value

So, let’s upgrade:

# zpool upgrade -a
This system supports ZFS pool feature flags.

Successfully upgraded 'system' from version 28 to feature flags.
Enabled the following features on 'system':
  async_destroy
  empty_bpobj
  lz4_compress

If you boot from pool 'system', don't forget to update boot code.
Assuming you use GPT partitioning and da0 is your boot disk
the following command will do it:

        gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 da0

Here, I have no idea what to do. I boot from a raidz2, called system…

The zool looks like this:

$ zpool list
NAME     SIZE  ALLOC   FREE    CAP  DEDUP  HEALTH  ALTROOT
system    27T  13.3T  13.7T    49%  1.00x  ONLINE  -

$ zpool status
  pool: system
 state: ONLINE
  scan: scrub repaired 0 in 15h56m with 0 errors on Fri Nov 15 19:06:36 2013
config:

        NAME           STATE     READ WRITE CKSUM
        system         ONLINE       0     0     0
          raidz2-0     ONLINE       0     0     0
            gpt/disk0  ONLINE       0     0     0
            gpt/disk1  ONLINE       0     0     0
            gpt/disk2  ONLINE       0     0     0
            gpt/disk3  ONLINE       0     0     0
            gpt/disk4  ONLINE       0     0     0
            gpt/disk5  ONLINE       0     0     0
            gpt/disk6  ONLINE       0     0     0
            gpt/disk7  ONLINE       0     0     0
            gpt/disk8  ONLINE       0     0     0
            gpt/disk9  ONLINE       0     0     0

errors: No known data errors

From there, I can find the disk names with gpart show -l $ gpart show -l => 34 5860533101 ada0 GPT (2.7T) 34 94 1 bootcode6 (47k) 128 16777216 2 swapda6 (8.0G) 16777344 5838471168 3 disk6 (2.7T) 5855248512 5284623 – free – (2.5G) => 34 5860533101 ada1 GPT (2.7T) 34 94 1 bootcode8 (47k) 128 16777216 2 swapada0 (8.0G) 16777344 5838471168 3 disk8 (2.7T) 5855248512 5284623 – free – (2.5G) => 34 5860533101 da0 GPT (2.7T) 34 94 1 bootcode0 (47k) 128 16777216 2 swapda0 (8.0G) 16777344 5838471168 3 disk0 (2.7T) 5855248512 5284623 – free – (2.5G) => 34 5860533101 da1 GPT (2.7T) 34 94 1 bootcode1 (47k) 128 16777216 2 swapda1 (8.0G) 16777344 5838471168 3 disk1 (2.7T) 5855248512 5284623 – free – (2.5G) => 34 5860533101 da2 GPT (2.7T) 34 94 1 bootcode2 (47k) 128 16777216 2 swapda2 (8.0G) 16777344 5838471168 3 disk2 (2.7T) 5855248512 5284623 – free – (2.5G) => 34 5860533101 da3 GPT (2.7T) 34 94 1 bootcode3 (47k) 128 16777216 2 swapda3 (8.0G) 16777344 5838471168 3 disk3 (2.7T) 5855248512 5284623 – free – (2.5G) => 34 5860533101 da4 GPT (2.7T) 34 94 1 bootcode4 (47k) 128 16777216 2 swapda4 (8.0G) 16777344 5838471168 3 disk4 (2.7T) 5855248512 5284623 – free – (2.5G) => 34 5860533101 da5 GPT (2.7T) 34 94 1 bootcode5 (47k) 128 16777216 2 swapda5 (8.0G) 16777344 5838471168 3 disk5 (2.7T) 5855248512 5284623 – free – (2.5G) => 34 5860533101 da6 GPT (2.7T) 34 94 1 bootcode7 (47k) 128 16777216 2 swapda7 (8.0G) 16777344 5838471168 3 disk7 (2.7T) 5855248512 5284623 – free – (2.5G) => 34 5860533101 da7 GPT (2.7T) 34 94 1 bootcode9 (47k) 128 16777216 2 swapada1 (8.0G) 16777344 5838471168 3 disk9 (2.7T) 5855248512 5284623 – free – (2.5G)

There, I can see that disk0 is da7, and that ada0 is disk6

I suppose the solution is:

#!/bin/sh

disks="ada0 ada1 da0 da1 da2 da3 da4 da5 da6 da7"
for disk in ${disks}
do
  gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 ${disk}
done

I’ll definitely confirm that before I try it.

Website Pin Facebook Twitter Myspace Friendfeed Technorati del.icio.us Digg Google StumbleUpon Premium Responsive

2 thoughts on “zpool upgrade to get lz4_compress”

Leave a Comment

Scroll to Top