Ubuntu – What to call ZFS vdev that won’t change

Ubuntuzfs

I've got an Ubuntu (13.04) Desktop with ZFS support thanks to the PPA zfs-native/stable.

Everything was working really well. I created a RAID-Z1 pool called inground with the following command:

zpool create inground raidz1 sdb sdc sdd sde sdf

Later, after being unable to access the mount point I had created, I ran zpool status and nearly fell off my chair when I saw 1 unavailable and 2 corrupt vdevs in the pool. After a few deep breaths, I noticed that when I'd recently rebooted the system, I had a USD thumb drive in one of the front ports of my tower. This caused all of the /dev/sd* mappings to change, and everything made sense. I removed the USB drive, rebooted, and all was well.

My question is, how do I prevent this in the future? Is there a different, canonical, identifier I can use to refer to the physical drives when adding them as vdevs to the zpool?

Best Answer

You're not supposed to use /dev/sdX names for ZFS pools in cases where the SCSI device names can change. See the options under /dev/disk...

[root@Davalan /dev/disk]# cd by-
by-id/   by-path/ by-uuid/ 

I usually use the /dev/disk/by-id entries for my Linux zpools...

# zpool status
  pool: vol1
 state: ONLINE
  scan: scrub repaired 0 in 1h44m with 0 errors on Sat Jul  6 13:12:06 2013
config:

        NAME                               STATE     READ WRITE CKSUM
        vol1                               ONLINE       0     0     0
          mirror-0                         ONLINE       0     0     0
            scsi-35000c5003af99fa7         ONLINE       0     0     0
            scsi-35000cca0153ec2d0         ONLINE       0     0     0
          mirror-1                         ONLINE       0     0     0
            scsi-35000cca01540e340         ONLINE       0     0     0
            scsi-35000cca01540e298         ONLINE       0     0     0
        cache
          ata-STEC_M8IOPS-50_STM000136649  ONLINE       0     0     0

and...

[root@Davalan /dev/disk/by-id]# ls -1
ata-STEC_M8IOPS-50_STM000136649
ata-STEC_M8IOPS-50_STM000136649-part1
ata-STEC_M8IOPS-50_STM000136649-part9
scsi-35000c5003af99fa7
scsi-35000c5003af99fa7-part1
scsi-35000c5003af99fa7-part9
scsi-35000cca0153ec2d0
scsi-35000cca0153ec2d0-part1
scsi-35000cca0153ec2d0-part9
scsi-35000cca01540e298
scsi-35000cca01540e298-part1
scsi-35000cca01540e298-part9
scsi-35000cca01540e340
scsi-35000cca01540e340-part1
scsi-35000cca01540e340-part9
scsi-SATA_STEC_M8IOPS-50_STM000136649
scsi-SATA_STEC_M8IOPS-50_STM000136649-part1
scsi-SATA_STEC_M8IOPS-50_STM000136649-part9
wwn-0x5000a720300411f7
wwn-0x5000a720300411f7-part1
wwn-0x5000a720300411f7-part9
wwn-0x5000c5003af99fa7
wwn-0x5000c5003af99fa7-part1
wwn-0x5000c5003af99fa7-part9
wwn-0x5000cca0153ec2d0
wwn-0x5000cca0153ec2d0-part1
wwn-0x5000cca0153ec2d0-part9
wwn-0x5000cca01540e298
wwn-0x5000cca01540e298-part1
wwn-0x5000cca01540e298-part9
wwn-0x5000cca01540e340
wwn-0x5000cca01540e340-part1
wwn-0x5000cca01540e340-part9
Related Topic