Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

up vote 5 down vote accepted

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
share|improve this answer
    
Wow. Been using Linux systems for quite some time... never even knew about /dev/disk. Thanks! –  Chris Sep 16 '13 at 19:41
2  
It should be noted that the ZFS on Linux implementation is just not as smart as the native Solaris code. Under Solaris, you can expect changed disk numbering not to cause issues, while ZFS on Linux seems not to handle this case all that well. When creating pools off iSCSI devices which have longish by-anything names, it gets tiresome. –  the-wabbit Sep 16 '13 at 20:46

Good news is you can change the vdev configuration scheme by exporting and re-importing your pool. (from ZFS on Linux docs)

admin@Test-ZFS:~$ sudo zpool status tankz
  pool: tankz
 state: ONLINE
  scan: resilvered 15K in 0h0m with 0 errors on Tue Feb 25 16:36:18 2014
config:

        NAME        STATE     READ WRITE CKSUM
        tankz       ONLINE       0     0     0
          raidz1-0  ONLINE       0     0     0
            sdc     ONLINE       0     0     0
            sde     ONLINE       0     0     0
            sdd     ONLINE       0     0     0

errors: No known data errors

admin@Test-ZFS:~$ sudo zpool export tankz
admin@Test-ZFS:~$ sudo zpool import -d /dev/disk/by-id tankz
admin@Test-ZFS:~$ sudo zpool status tankz
  pool: tankz
 state: ONLINE
  scan: resilvered 15K in 0h0m with 0 errors on Tue Feb 25 16:36:18 2014
config:

        NAME                                       STATE     READ WRITE CKSUM
        tankz                                      ONLINE       0     0     0
          raidz1-0                                 ONLINE       0     0     0
            ata-VBOX_HARDDISK_VB3b2901c3-c7700ec9  ONLINE       0     0     0
            ata-VBOX_HARDDISK_VB4ad696a7-d3e6b542  ONLINE       0     0     0
            ata-VBOX_HARDDISK_VBbed2a908-5ddcaedb  ONLINE       0     0     0

errors: No known data errors
share|improve this answer
    
Nice trick! This would surely have been easier than destroying-and-recreating the pool. –  Chris Feb 26 at 13:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.