From 66233a11389d392094d7a17c97a9a88dbc775cc8 Mon Sep 17 00:00:00 2001 From: Richard Laager Date: Thu, 31 Dec 2020 10:48:42 -0600 Subject: [PATCH] Debian: Add a work-around to preserve zpool.cache The zpool.cache file is getting cleared by zfs-import-bpool.service. A work-around is to move the cache file out of the way before the import and restore it after: https://github.com/openzfs/zfs/discussions/8549#discussioncomment-231334 The suggestion there is suppressing errors with `|| true`, which can also be done by prefixing the command with `-`. (I verified that the systemd in Buster is new enough to support that.) If we are suppressing errors anyway, I'm not sure there's a benefit to checking for the file rather than just trying the move and letting it fail. The latter approach avoids the shell entirely. So I changed it. Closes #97 Suggested-by: Andrey Prokopenko <9478806+terem42@users.noreply.github.com> Tested-by: Hevisko Signed-off-by: Richard Laager --- docs/Getting Started/Debian/Debian Buster Root on ZFS.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/Getting Started/Debian/Debian Buster Root on ZFS.rst b/docs/Getting Started/Debian/Debian Buster Root on ZFS.rst index cd422fa..1f9b732 100644 --- a/docs/Getting Started/Debian/Debian Buster Root on ZFS.rst +++ b/docs/Getting Started/Debian/Debian Buster Root on ZFS.rst @@ -691,6 +691,9 @@ Step 4: System Configuration Type=oneshot RemainAfterExit=yes ExecStart=/sbin/zpool import -N -o cachefile=none bpool + # Work-around to preserve zpool cache: + ExecStartPre=-/bin/mv /etc/zfs/zpool.cache /etc/zfs/preboot_zpool.cache + ExecStartPost=-/bin/mv /etc/zfs/preboot_zpool.cache /etc/zfs/zpool.cache [Install] WantedBy=zfs-import.target