4

I created my first zpool the other day, assigning by drive letter, and found that when I rebooted it was degraded. Upon closer inspection, I realized that my drive letters had changed with reboot, so I figured I should do it using UUIDs.

I took a look at blkid and saw that both drives had identical uuids, presumably because they are mirrored. So I destroyed the pool and created new partition tables on the disks. When I ran blkid again, I saw that the drives no longer had UUIDs, just a PTID. This led me to realizingt that UUID is a property of a filesystem, not the drive itself.

So, I tried using /dev/disk/by-id/ both with the UUID of the formatted drive, and the PTID of the unformatted drive. Neither worked.

user@ubuntu:~$ sudo zpool create nvme-tank mirror /dev/disk/by-id/493fa01d /dev/disk/by-id/9398aa9e
cannot resolve path '/dev/disk/by-id/493fa01d'

user@ubuntu:~$ sudo zpool create nvme-tank mirror /dev/disk/by-id/713e95ab-f307-466c-bc6c-f9ec97914a6a /dev/disk/by-id/44042f83-1654-45b4-9803-42107393af6c
cannot resolve path '/dev/disk/by-id/713e95ab-f307-466c-bc6c-f9ec97914a6a'

this is the output of blkid:

/dev/sdb1: UUID="1977-5195" TYPE="vfat" PARTUUID="117c616a-01"
/dev/sdd1: UUID="3d09d690-6110-3c87-abb6-c286e58cf8ae" UUID_SUB="481418c7-ff1c-3ee6-21e1-48be73d0a083" LABEL="ubuntu:0" TYPE="linux_raid_member" PARTUUID="edbfb533-01"
/dev/sdd2: UUID="bb4a8e51-48de-3c04-435f-d48ba763b176" UUID_SUB="3cd3b591-6c08-23df-c885-812b8a4dae09" LABEL="ubuntu:1" TYPE="linux_raid_member" PARTUUID="edbfb533-02"
/dev/sde1: UUID="3d09d690-6110-3c87-abb6-c286e58cf8ae" UUID_SUB="294836fe-a958-5aa8-f9e7-fcb0d5b3ad68" LABEL="ubuntu:0" TYPE="linux_raid_member" PARTUUID="870c34a5-01"
/dev/sde2: UUID="bb4a8e51-48de-3c04-435f-d48ba763b176" UUID_SUB="4f2b1400-7d20-79f5-106f-33fdb0dafc36" LABEL="ubuntu:1" TYPE="linux_raid_member" PARTUUID="870c34a5-02"
/dev/md1: UUID="be1c70fd-3000-4a69-9106-efc73309693d" TYPE="ext4"
/dev/md0: UUID="4c0b7a2c-1b40-4979-868a-0e363bcbe771" TYPE="swap"
/dev/nvme1n1p1: UUID="713e95ab-f307-466c-bc6c-f9ec97914a6a" TYPE="ext4" PARTUUID="9398aa9e-01"
/dev/nvme2n1p1: UUID="24d22c02-be8f-41ba-9907-9494b03c16bb" TYPE="ext4" PARTUUID="edc5ee37-01"
/dev/nvme0n1p1: UUID="44042f83-1654-45b4-9803-42107393af6c" TYPE="ext4" PARTUUID="493fa01d-01"
/dev/nvme0n1: PTUUID="493fa01d" PTTYPE="dos"
/dev/nvme2n1: PTUUID="edc5ee37" PTTYPE="dos"
/dev/nvme1n1: PTUUID="9398aa9e" PTTYPE="dos"
/dev/sda: PTUUID="d5f5a456" PTTYPE="dos"
/dev/sdc: PTUUID="b462c818" PTTYPE="dos"

some of the threads I looked at led me to look at /etc/default/zfs I found that the relevant line was commented out, but I wasn't sure what to make about the comments above it, which are worded in a way that confuses me:

# Specify specific path(s) to look for device nodes and/or links for the
# pool import(s). See zpool(8) for more information about this variable.
# It supersedes the old USE_DISK_BY_ID which indicated that it would only
# try '/dev/disk/by-id'.
# The old variable will still work in the code, but is deprecated.
#ZPOOL_IMPORT_PATH="/dev/disk/by-vdev:/dev/disk/by-id"

So, my question is, can I directly create zpools using a unique and permenant identifier, such as serial number? Or is there another way to create them by UUID that actually works?

I am using ZFS on Ubuntu Server 18.04

Edit: Further attempts I also tried the advice here: https://ubuntuforums.org/showthread.php?t=2087726

user@ubuntu:~$ sudo zpool create nvme-tank mirror nvme0n1 nvme1n1
user@ubuntu:~$ sudo zpool export nvme-tank
user@ubuntu:~$ sudo zpool import -d /dev/disk/by-id nvme-tank

But now I don't see them in blkid at all:

/dev/sdb1: UUID="1977-5195" TYPE="vfat" PARTUUID="117c616a-01"
/dev/sdd1: UUID="3d09d690-6110-3c87-abb6-c286e58cf8ae" UUID_SUB="481418c7-ff1c-3ee6-21e1-48be73d0a083" LABEL="ubuntu:0" TYPE="linux_raid_member" PARTUUID="edbfb533-01"
/dev/sdd2: UUID="bb4a8e51-48de-3c04-435f-d48ba763b176" UUID_SUB="3cd3b591-6c08-23df-c885-812b8a4dae09" LABEL="ubuntu:1" TYPE="linux_raid_member" PARTUUID="edbfb533-02"
/dev/sde1: UUID="3d09d690-6110-3c87-abb6-c286e58cf8ae" UUID_SUB="294836fe-a958-5aa8-f9e7-fcb0d5b3ad68" LABEL="ubuntu:0" TYPE="linux_raid_member" PARTUUID="870c34a5-01"
/dev/sde2: UUID="bb4a8e51-48de-3c04-435f-d48ba763b176" UUID_SUB="4f2b1400-7d20-79f5-106f-33fdb0dafc36" LABEL="ubuntu:1" TYPE="linux_raid_member" PARTUUID="870c34a5-02"
/dev/md1: UUID="be1c70fd-3000-4a69-9106-efc73309693d" TYPE="ext4"
/dev/md0: UUID="4c0b7a2c-1b40-4979-868a-0e363bcbe771" TYPE="swap"
/dev/nvme2n1p1: UUID="24d22c02-be8f-41ba-9907-9494b03c16bb" TYPE="ext4" PARTUUID="edc5ee37-01"

2 Answers 2

2

UUID is not always visible, (specially in VM env) I suggest to create a partition table and use PARTUUID

after you are able to list the desidered partition

lsblk --ascii -o NAME,PARTUUID,LABEL,PATH,FSTYPE
zpool create pool02 /dev/disk/by-partuuid/c8e0c300-5ec9-714c-aef9-fa0dc3f0cab6

there no performance penalties when partition table against entire raw disk and examining the partition table may save your work in case of Disaster recovery

1

I got past this using the Arch documentation for ZFS: Creating a storage pool.

destroyed my old pool

user@ubuntu:~$ sudo zpool destroy nvme-tank
user@ubuntu:~$ zpool list
no pools available

Got the Disk SerialNumber-based IDs (not uuids) Persistent block device naming;by-id and by-path.

'by-id creates a unique name depending on the hardware serial number, by-id also creates World Wide Name links of storage devices that support it. Unlike other by-id links, WWNs are fully persistent and will not change depending on the used subsystem. '

user@ubuntu:~$ ls -lh /dev/disk/by-id/
total 0
lrwxrwxrwx 1 root root  9 Oct  9 17:04 ata-HGST_HUH728080ALN600_VJH620YX -> ../../sda
lrwxrwxrwx 1 root root  9 Oct  9 17:04 ata-HGST_HUH728080ALN600_VJH624KX -> ../../sdc
lrwxrwxrwx 1 root root  9 Oct  9 17:04 ata-Samsung_SSD_850_EVO_120GB_S21SNX0H915160K -> ../../sdd
lrwxrwxrwx 1 root root 10 Oct  9 17:04 ata-Samsung_SSD_850_EVO_120GB_S21SNX0H915160K-part1 -> ../../sdd1
lrwxrwxrwx 1 root root 10 Oct  9 17:04 ata-Samsung_SSD_850_EVO_120GB_S21SNX0H915160K-part2 -> ../../sdd2
lrwxrwxrwx 1 root root  9 Oct  9 17:04 ata-Samsung_SSD_850_EVO_120GB_S21SNX0H915161E -> ../../sde
lrwxrwxrwx 1 root root 10 Oct  9 17:04 ata-Samsung_SSD_850_EVO_120GB_S21SNX0H915161E-part1 -> ../../sde1
lrwxrwxrwx 1 root root 10 Oct  9 17:04 ata-Samsung_SSD_850_EVO_120GB_S21SNX0H915161E-part2 -> ../../sde2
lrwxrwxrwx 1 root root  9 Oct  9 17:04 md-name-ubuntu:0 -> ../../md0
lrwxrwxrwx 1 root root  9 Oct  9 17:04 md-name-ubuntu:1 -> ../../md1
lrwxrwxrwx 1 root root  9 Oct  9 17:04 md-uuid-3d09d690:61103c87:abb6c286:e58cf8ae -> ../../md0
lrwxrwxrwx 1 root root  9 Oct  9 17:04 md-uuid-bb4a8e51:48de3c04:435fd48b:a763b176 -> ../../md1
lrwxrwxrwx 1 root root 13 Oct  9 17:04 nvme-eui.0025385481b1ea19 -> ../../nvme2n1
lrwxrwxrwx 1 root root 15 Oct  9 17:04 nvme-eui.0025385481b1ea19-part1 -> ../../nvme2n1p1
lrwxrwxrwx 1 root root 13 Oct  9 19:11 nvme-eui.0025385581b40c9c -> ../../nvme0n1
lrwxrwxrwx 1 root root 13 Oct  9 19:11 nvme-eui.0025385581b40e03 -> ../../nvme1n1
lrwxrwxrwx 1 root root 13 Oct  9 17:04 nvme-Samsung_SSD_960_EVO_1TB_S3X3NF0K400271N -> ../../nvme2n1
lrwxrwxrwx 1 root root 15 Oct  9 17:04 nvme-Samsung_SSD_960_EVO_1TB_S3X3NF0K400271N-part1 -> ../../nvme2n1p1
lrwxrwxrwx 1 root root 13 Oct  9 19:11 nvme-Samsung_SSD_970_EVO_1TB_S467NF0K510805L -> ../../nvme0n1
lrwxrwxrwx 1 root root 13 Oct  9 19:11 nvme-Samsung_SSD_970_EVO_1TB_S467NF0K511164Z -> ../../nvme1n1
lrwxrwxrwx 1 root root  9 Oct  9 17:04 usb-Samsung_Flash_Drive_0373617100005284-0:0 -> ../../sdb
lrwxrwxrwx 1 root root 10 Oct  9 17:04 usb-Samsung_Flash_Drive_0373617100005284-0:0-part1 -> ../../sdb1
lrwxrwxrwx 1 root root  9 Oct  9 17:04 wwn-0x5000cca261d0d95a -> ../../sda
lrwxrwxrwx 1 root root  9 Oct  9 17:04 wwn-0x5000cca261d0d9ca -> ../../sdc
lrwxrwxrwx 1 root root  9 Oct  9 17:04 wwn-0x5002538d413f3b81 -> ../../sdd
lrwxrwxrwx 1 root root 10 Oct  9 17:04 wwn-0x5002538d413f3b81-part1 -> ../../sdd1
lrwxrwxrwx 1 root root 10 Oct  9 17:04 wwn-0x5002538d413f3b81-part2 -> ../../sdd2
lrwxrwxrwx 1 root root  9 Oct  9 17:04 wwn-0x5002538d413f3b87 -> ../../sde
lrwxrwxrwx 1 root root 10 Oct  9 17:04 wwn-0x5002538d413f3b87-part1 -> ../../sde1
lrwxrwxrwx 1 root root 10 Oct  9 17:04 wwn-0x5002538d413f3b87-part2 -> ../../sde2

Made the new pool, seems to work. I guess the first device in the pool not showing in lsblk is expected?

user@ubuntu:~$ sudo zpool create nvme-tank mirror nvme-Samsung_SSD_970_EVO_1TB_S467NF0K510805L nvme-Samsung_SSD_970_EVO_1TB_S467NF0K511164Z
user@ubuntu:~$ blkid
/dev/sdb1: UUID="1977-5195" TYPE="vfat" PARTUUID="117c616a-01"
/dev/sdd1: UUID="3d09d690-6110-3c87-abb6-c286e58cf8ae" UUID_SUB="481418c7-ff1c-3ee6-21e1-48be73d0a083" LABEL="ubuntu:0" TYPE="linux_raid_member" PARTUUID="edbfb533-01"
/dev/sdd2: UUID="bb4a8e51-48de-3c04-435f-d48ba763b176" UUID_SUB="3cd3b591-6c08-23df-c885-812b8a4dae09" LABEL="ubuntu:1" TYPE="linux_raid_member" PARTUUID="edbfb533-02"
/dev/sde1: UUID="3d09d690-6110-3c87-abb6-c286e58cf8ae" UUID_SUB="294836fe-a958-5aa8-f9e7-fcb0d5b3ad68" LABEL="ubuntu:0" TYPE="linux_raid_member" PARTUUID="870c34a5-01"
/dev/sde2: UUID="bb4a8e51-48de-3c04-435f-d48ba763b176" UUID_SUB="4f2b1400-7d20-79f5-106f-33fdb0dafc36" LABEL="ubuntu:1" TYPE="linux_raid_member" PARTUUID="870c34a5-02"
/dev/md1: UUID="be1c70fd-3000-4a69-9106-efc73309693d" TYPE="ext4"
/dev/md0: UUID="4c0b7a2c-1b40-4979-868a-0e363bcbe771" TYPE="swap"
/dev/nvme2n1p1: UUID="24d22c02-be8f-41ba-9907-9494b03c16bb" TYPE="ext4" PARTUUID="edc5ee37-01"
/dev/nvme1n1: LABEL="nvme-tank" UUID="12820183881567404585" UUID_SUB="7696346709622828030" TYPE="zfs_member"
3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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