Formatting/creating file system on multipath volume for ZFS on Linux?

elleciel asked:

I inherited a ZFS on Linux (CentOS) storage pool and I have a faulty multipath device (mpathah) in my pool:

      raidz3-6   DEGRADED     0     0     0
        mpathba  ONLINE       0     0     0
        mpathbb  ONLINE       0     0     0
        mpathbc  ONLINE       0     0     0
        mpathah  FAULTED      ...    

I’ve loosely followed the Solaris ZFS instructions on replacing a faulty disk and swapped out the disk. It seems multipathd automatically picks up the new disk and assigns it mpathcn, so now I try to replace the old device but get the following error:

$ zpool replace mypool mpathah mpathcn
invalid vdev specification
use '-f' to override the following errors:
/dev/mapper/mpathcn contains a filesystem of type 'vfat'

Indeed it seems the rest of the multipath devices on this vdev are formatted differently:

$ blkid /dev/mapper/mpathcn
/dev/mapper/mpathcn: LABEL="HDD" UUID="xxxx-xxxx" TYPE="vfat"

$ blkid /dev/mapper/mpathbc
/dev/mapper/mpathbc: LABEL="mypool" UUID="xxxx" UUID_SUB="xxxx" TYPE="zfs_member"

What’s the right way to do this? I found a similar previous question – is this correct?

$ pvcreate /dev/mapper/mpathcn

My answer:

Most likely your new virtual disk had a VFAT filesystem on it and was not erased before you reused it.

It’s safe to use it with zpool replace -f but this will destroy any old data on the disk, as ZFS will begin resilvering immediately.

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.