Howto make zfs wait to import zpools on boot until mfconfig is finished? reddit / freebsd ---------------------------------------------------------------------- bufo333 · 2022-08-21 05:40 I have a system that is all ufs. I have a need to move some jails from a failing server temporarily. I created a file backed storage device which shows up as /dev/md0. I then created a zpool with that device. I then imported the zfs jails managed with iocage from the failing server. Everything started up perfectly. I need to maintain this for about 2 months due to supply chain issues, other server replacement parts are back ordered... don't get me started on maintenance agreements. I added the correct mdconfig lines to rc.conf and everything reboots fine, however on boot zfs tries to import the pools before mdconfig creates the /dev/md0 device. This causes it to fail to detect any pools and causes iocage to fail on startup. Right now my solution has been to manually import the pool and restart iocage. I have certain patching requirements that sometimes require a reboot, so I need this to survive a reboot at least for the next 60 days. Any suggestions on how I can delay zfs pool import until mdconfig has done its work, or move the mdconfig process ealier in the boot process? ---------------------------------------------------------------------- CoolTheCold · 2022-08-21 06:13 Will be watching discussions - I can imagine how to do services deps via systemd (I have similar setup with loopback files as block devices on test server) , here should be some way too ---------------------------------------------------------------------- edthesmokebeard · 2022-08-21 15:28 No idea how to do it officially, but a final rc.local script that looks for the existence of /dev/md0 and runs the import would work. Super hack though. ---------------------------------------------------------------------- bufo333 · 2022-08-21 20:34 Yeah I thought about hacking a solution like that, but I was hoping somebody knew the canonical way to do it. ---------------------------------------------------------------------- DimestoreProstitute · 2022-08-22 05:10 You have zfs_enabled set in rc.conf I assume? As this is a somewhat non-standard setup, if it were my system I'd unset zfs_enabled and setup a separate script run from /etc/rc.local that checks for the existence of md0 and manually mounts the ZFS datasets. Once adequately tested this should survive a reboot. You could write your own /etc/rc.d script as well but as you mentioned this is temporary it may not be worth that level of effort. Edit: I personally wouldn't try modifying existing rc.d scripts to try and build your md0 earlier if you can possibly help it-- you can run yourself into unusual cyclical dependency problems that way (has happened to me). In that case writing your own rc.d script that depends on the md0 mount is probably the most appropriate route