8

I want to replace one ZFS filesystem (volume in a pool) with another ZFS filesystem (another volume in the same pool). Rebooting is okay, but I'd like to avoid single user mode.

When I try to set mountpoint=none on the old filesystem, ZFS tries to unmount it, which fails due to files being in use. Consequently, I can't set mountpoint=/data on the new filesystem due to something being mounted there. The mountpoint properties are also not written to the filesystems.

If I reboot, the old filesystem is still mounted, services will start using files on there and I can't unmount it anymore. Is there a way to write the mountpoint properties on the filesystems without actually changing anything that's mounted, and then reboot so that the new filesystem is in use when the system comes up again?

1 Answer 1

1

In newer versions of OpenZFS, there is the zfs set -u flag.

zfs set -u mountpoint=/data-old zpool/data1
zfs set -u mountpoint=/data zpool/data2

Now the properties are changed, but nothing is changed to the current mountpoints; /data still points to zpool/data1, but after a reboot, it will be zpool/data2.

1
  • 1
    For those wondering what counts as "newer versions of OpenZFS": you need to be using version 2.2.0 or higher. Version 2.2.0 was released on October 13th, 2023; and the -u flag was added in commit 4e16964 on October 2nd, 2023. Nov 28, 2023 at 2:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .