zfsonlinux / pkg-zfs

Native ZFS packaging for Debian and Ubuntu
https://launchpad.net/~zfs-native/+archive/daily
308 stars 55 forks source link

zpool import adds wrong device names #177

Closed Ryushin closed 8 years ago

Ryushin commented 8 years ago

Running Debian Wheezy with zfs 0.6.5.2-2-wheezy packages. I rebooted the system and it imported most of the devices with /dev/sd*: http://pastebin.com/qMvxyCpr

Exporting and importing the netshares pool with the -d /dev/disk/by-id allowed it to import with the correct names. I purposely cleared out everything except the wwn names in /dev/disk/by-id so the import would have just the wwn names for the devices.

Export and import the pool resulted in /dev/sd* devices again. Exported and imported with -d again, wrote a new zpool.cache file. Export, import again and the devices showed up as sd* devices again.

Uncommenting ZPOOL_IMPORT_PATH="/dev/disk/by-vdev:/dev/disk/by-id" in /etc/default/zfs and running the export/import again did not change anything. Updating initramfs and rebooting while leaving the ZPOOL_IMPORT_PATH uncommented resulted in devices importing with /dev/disk/by-id/scsi and wwn: http://pastebin.com/9DeBXkGU

It seems like the zpool.cache file is not being used any longer in the initramfs even though it is in the initramfs file. Is is possible to change ZPOOL_IMPORT_PATH to "/dev/disk/by-id/wwn*""

FransUrbo commented 8 years ago

This is not a support forum. Please take support questions to either the IRC channel or the mailing list.

The ZPOOL_IMPORT_PATH is a path variable, not a file variable (which you would get in your last example). The fact that the by-id directory contains both device nodes based on ID and WWM is a problem, but out of our control. If you MUST use WWMs, then the only option is to use a cache file.

To force the use of the/a cache file, see the example below the ZPOOL_CACHE entry:

ZPOOL_IMPORT_OPTS="-c /etc/zfs/zpool.cache"
ZPOOL_CACHE=""

Every time you change that file (in a matter that affects the initrd) or update/change the cache file, you need to update the initrd. A simple export/import won't help, because the zpool command does not read that file, only the initrd and SYSV init scripts do...