change ZFS hdd from dev to UUID
Posted: Mon Jun 16, 2025 5:56 pm
In Linux, when working with ZFS and storage devices, it's generally recommended to use the ata-* or scsi-* paths within /dev/disk/by-id/ instead of the wwn-* paths, particularly for SATA and SAS drives. This is because wwn-* paths, while representing World Wide Names, can be less reliable and harder to correlate with physical devices compared to the more descriptive ata-* or scsi-* names.
Here's why and how to switch:
Why use ata-* or scsi-* over wwn-*?
Reliability: wwn-* paths are based on the drive's WWN (World Wide Name), which is a unique identifier, but not all drives reliably advertise them, and they can be more difficult to correlate with the physical drive.
Descriptive: ata-* and scsi-* paths often include the drive's model and serial number, making it easier to identify the specific drive.
Consistency: ata-* and scsi-* paths tend to be more consistent across reboots and hardware changes.
How to change ZFS device references:
Identify your drives: Use ls -l /dev/disk/by-id/ to see the available paths. You'll likely see both wwn-* and ata-* (or scsi-*) entries for each drive.
Export the ZFS pool: Before making changes, export the pool to avoid data loss.
Modify the pool: You can either manually edit the vdev_id.conf file or, if you are using the zpool import command, you can specify the new paths with the -d option. For example:
or
This command imports the pool using the specified ata-* paths.
Import the pool: Import the pool with the new device references.
Here's why and how to switch:
Why use ata-* or scsi-* over wwn-*?
Reliability: wwn-* paths are based on the drive's WWN (World Wide Name), which is a unique identifier, but not all drives reliably advertise them, and they can be more difficult to correlate with the physical drive.
Descriptive: ata-* and scsi-* paths often include the drive's model and serial number, making it easier to identify the specific drive.
Consistency: ata-* and scsi-* paths tend to be more consistent across reboots and hardware changes.
How to change ZFS device references:
Identify your drives: Use ls -l /dev/disk/by-id/ to see the available paths. You'll likely see both wwn-* and ata-* (or scsi-*) entries for each drive.
Export the ZFS pool: Before making changes, export the pool to avoid data loss.
Code: Select all
zpool export <pool_name>Code: Select all
zpool import -d /dev/disk/by-id/ata-<drive1_id> -d /dev/disk/by-id/ata-<drive2_id> <pool_name>Code: Select all
zpool import -d /dev/disk/by-id/ata-WDC_WD40EFZX-68AWUN0_WD-WX92D41PD96L-part1 -d /dev/disk/by-id/ata-WDC_WD40EFZX-68AWUN0_WD-WXA2D21RVAKD-part1 -d /dev/disk/by-id/ata-WDC_WD40EFZX-68AWUN0_WD-WXA2D21RVRXY-part1 -d /dev/disk/by-id/ata-WDC_WD40EFZX-68AWUN0_WD-WXA2D21RVTP1-part1 zfs-raidz1Import the pool: Import the pool with the new device references.
Code: Select all
zpool import <pool_name>