Fix ZFS Pool After Device Label Change in Ubuntu 13.10

I use ZFS for a RAIDZ (1 disk worth of parity) backup on my HP Microserver. I decided to upgrade it to the latest Ubuntu (13.10) as it’s been out a few months now so should be nice and stable.

However, after the upgrade my backup pool was unavailable! Looks like the disk labels have changed in the new kernel.

sudo zpool status backups


  pool: backups
 state: UNAVAIL
status: One or more devices could not be used because the label is missing
       or invalid. There are insufficient replicas for the pool to continue
action: Destroy and re-create the pool from
        a backup source.
  scan: none requested

        NAME                   STATE     READ WRITE CKSUM
        backups                UNAVAIL      0     0     0  insufficient replicas
          raidz1-0             UNAVAIL      0     0     0  insufficient replicas
            scsi-SATA_WDC_XXX  UNAVAIL      0     0     0
            scsi-SATA_WDC_YYY  UNAVAIL      0     0     0
            scsi-SATA_WDC_ZZZ  UNAVAIL      0     0     0

I fixed it by doing the following:

sudo zpool export backups
sudo import -d /dev/disk/by-id/ backups -f

Where backups is the name of the pool and I used -f to force the import. Without -f it said:

cannot import 'backups': pool may be in use from other system
use '-f' to import anyway

That ‘other system’ was this system before the upgrade!

After the import:

zpool status

now gives:

  pool: backups
 state: ONLINE
  scan: scrub repaired 0 in 4h6m with 0 errors on ...

        NAME                      STATE     READ WRITE CKSUM
        backups                   ONLINE       0     0     0
          raidz1-0                ONLINE       0     0     0
            ata-WDC_WD15EADS-XXX  ONLINE       0     0     0
            ata-WDC_WD30EZRX-YYY  ONLINE       0     0     0
            ata-WDC_WD30EZRX-ZZZ  ONLINE       0     0     0


This should also be applicable for Ubuntu 14.04, 14.10, 15.04 etc.