Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stale zpool.cache in initrd #3

Open
mrdrmmn opened this issue Mar 9, 2013 · 2 comments
Open

stale zpool.cache in initrd #3

mrdrmmn opened this issue Mar 9, 2013 · 2 comments
Labels

Comments

@mrdrmmn
Copy link

mrdrmmn commented Mar 9, 2013

/etc/zfs/zpool.cache gets built into the initrd. This can become problematic and prevent your zfs filesystems from mounting at boot and require them to be forcibly re-imported. As a workaround, you can run 'update-initramfs -k all -u' and that will fix the problem short term.

This became a problem for me because I create a pool using the /dev/sd? names from disks that were attached via USB. While I have this pool attached via USB, there was an update which triggered my initrd to be rebuilt. I them moved these disk onto my sata controller and off of the usb device and then imported it with 'zpool import -d /dev/disk/by-id [pool]'. Everything was working and then I rebooted and none of my zpools mounted (except for my root zpool). A zpool status showed that the pool was unavailable because the /dev/sd? devices were missing. So I exported the pool, did an import as mentioned above and that failed until I added -f to the import which was successful. I checked the contents of zpool.cache and it correctly had the device paths using by-id.

At this point I rebooted and the whole process started over again. The zpool.cache had the correct information, but zpool status showed the wrong device paths. I get everything back into working order and rebuilt my initrd. Finally I rebooted and all was well.

Really, the zpool.cache file should not be in the initrd. But clearly it is and it is being used and causing a problem. Perhaps updating the code to ensure that the zpool.cache file is ignored prior to the real / is mounted?

@dajhorn
Copy link
Member

dajhorn commented Mar 12, 2013

Some early tentative planning is happening to deprecate and obsolesce the zpool.cache file, which should solve this problem.

In the meantime, if you don't need the zpool.cache file on your system, then put a rm "$DESTDIR/etc/zfs/zpool.cache" line at the bottom of the /usr/share/initramfs-tools/hooks/zdev file, and optionally dpkg-divert it so that it will not be overwritten during upgrades.

@mrdrmmn
Copy link
Author

mrdrmmn commented Mar 12, 2013

I may give that a try in the next day or so. But ultimately, I don't normally have disks moving around like this (nor do most people). I just happened to be unlucky with the timing of things this time and figured it was worth the effort of noting it so that others at least have something they can find via google at least. :)

Given the the zpool.cache is getting deprecated, and the rarity of this actually causing any problems, I would say that there is no reason to spend any dev time trying to hack another fix in ahead of time. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants