zfsonlinux / pkg-zfs

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

Separate zpool.cache for initramfs? #157

Closed sadboy closed 9 years ago

sadboy commented 9 years ago

I'm wondering if it is possible to specify a fixed version of zpool.cache for initramfs?

The reason is that I have numerous zpools on removable media. If, during a session when I have a removable zpool imported, the update manager triggers an update that regenerates the initramfs, the current version of /etc/zfs/zpool.cache will get packed into the initramfs image, which includes the zpool on removable media. Then, on the next reboot if the media is not plugged in, zfs will try to import the non-existing pool and the boot process takes much longer.

Since the only pool that has to be brought up in the initramfs phase is the pool containing the root filesystem, and that pool seldom changes, I think it makes sense to be able to specify a "fixed" version of zpool.cache just for initramfs. Or have something like "ZFS_INITRD_POOL = rootpool" as a configurable parameter and let the script parse zpool.cache to extract the entry for the root pool. Or am I missing something here?

FransUrbo commented 9 years ago

I'm wondering if it is possible to specify a fixed version of zpool.cache for initramfs?

Why not just go without cache file? It's almost never actually needed.

sadboy commented 9 years ago

Why not just go without cache file? It's almost never actually needed.

I can? Isn't that file auto generated?

FransUrbo commented 9 years ago

I can? Isn't that file auto generated?

Yes and yes. The default is to have one, and that's only because of "old habit". I've created a pull request to change the default, but that might not be applied until after 0.6.5 (which isn't TO far off we hope). Best case, it'll be applied before, we haven't decided (agreed on) which yet :)

zpool set cachefile=none <poolname>

and it will removed. If you notice any problems with this, just get your pool imported and run

zpool set cachefile='' <poolname>

This will generate a cache file in the default location (/etc/zfs/zpool.cache).

The only place we're SURE might (!) need, or at least benefit from, a cache file is pools with a lot of vdevs (devices). But there might be others, so if you experience any problem, please let us know!

sadboy commented 9 years ago

zpool set cachefile=none

Ah, great! That solved everything, thanks! :)