initramfs-zfs should support misc /dev dirs

Bug #1688890 reported by Jens Elkner
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
zfs-linux (Ubuntu)
Fix Released
Undecided
Unassigned
Xenial
New
Undecided
Unassigned
Bionic
Fix Released
Undecided
Unassigned

Bug Description

Right now 'zfs-initramfs', i.e. /usr/share/initramfs-tools/scripts/zfs does not support any other directory than /dev for "zpool import ...". Therefore even if a pool gets created from a different directory like /dev, say /dev/disk/by-id or /dev/chassis/SYS on next reboot /dev will be used and thus zpool status will show the /dev/sd* etc. on successful import. Beside that now a user does not see the original names used in "zpool create ..." the unstable names like "/dev/sd*" are shown, which is explicitly NOT recommended.

The following patch introduces the "pseudo" kernel param named "zdirs" - a comma separated list of dev dirs to scan on import - which gets used by /usr/share/initramfs-tools/scripts/zfs to honor it.

Tags: patch
Revision history for this message
Jens Elkner (jelmd) wrote :
affects: grub2 (Ubuntu) → zfs-linux (Ubuntu)
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "honor misc /dev dirs" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in zfs-linux (Ubuntu):
status: New → Confirmed
Revision history for this message
Richard Laager (rlaager) wrote :

I need to do some testing, but we might want to consider using the cache file. An approach (suggested to my by ryao, I think) was that we first import the root pool read-only, copy the cache file out of it, export the pool, and then import the pool read-write using the cache file.

Revision history for this message
Colin Ian King (colin-king) wrote :

@Richard, any followup on that testing?

Revision history for this message
Richard Laager (rlaager) wrote :

I haven't had a chance to write and test the zpool.cache copying. I keep meaning to get to it every day, but pushing it back for lack of time.

The zfs-initramfs script in 16.04 (always) and in 18.04 (by default) runs a plain `zpool import`.

ZoL 0.7.5 has a default search order for imports that prefers /dev/disk/by-id:
https://github.com/zfsonlinux/zfs/blob/zfs-0.7.5/lib/libzfs/libzfs_import.c#L1835

That said, so did ZoL on Xenial (0.6.5.6).

On my bionic test VM, non-root pools import using whatever name I created them with. If I use /dev, they import later with /dev. If I use /dev/disk/by-id, they import later with /dev/disk/by-id. This is true immediately, and true across reboots.

Root pools seem to behave the same way. My root pool was created using /dev/disk/by-id per the HOWTO (which I maintain) and is being imported with /dev/disk/by-id. This is with no zpool.cache, either on the live system or in the initramfs (which I unpacked to verify).

In other words, I cannot reproduce this on bionic. I'm pretty confident this is an issue on Xenial, though I haven't re-tested just now to absolutely confirm. But I will say that on my Xenial laptop at the moment, my root pool is imported with a /dev name.

In short, I think this is fixed in Bionic, but I'm not 100% sure which code changed to fix it.

Changed in zfs-linux (Ubuntu):
milestone: none → bionic-updates
milestone: bionic-updates → none
Changed in zfs-linux (Ubuntu Bionic):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.