1

I am transitioning from an old Ubuntu installation to a new one. While transitioning, I want to be able to use the same pool from the old and the new OS.

The new OS will be on a different disk. I select the OS during boot. Only one OS will be using the pool at any particular time.

Is this possible at all? Do I risk data corruption or loosing the whole pool?

2

As long as the pool is exported during shutdown, and is only ever used from one system at a time, what you discuss should be unproblematic.

ZFS really, really, really doesn't like the same pool being used from multiple systems at once, even in read-only mode (-o readonly=on given to zpool import), but this doesn't seem to apply to your situation.

To maintain compatibility between the two versions, you'd make very sure not to run zpool upgrade or zfs upgrade especially from the newer installation. Either of those could result in loss of access to the pool or filesystem when running the older installation, but neither should result in loss of the pool or file system when running a system that supports the ZFS on-disk version upgraded to.

Once you're done upgrading, if you want to, then you can upgrade the pool to the latest on-disk format and features using zpool upgrade and/or zfs upgrade as necessary.

| improve this answer | |
1

Assuming you're talking about using the pool as data storage, not running the system root in it, you'll be fine.

I have currently two systems installed, one on an EXT4 partition and the other in a zfs dataset that has sudo zfs set mountpoint=/ tank/my/dataset.
Accessing this pool from the EXT4 system is a pain, because zfs mount -a would fail mounting to root. So instead here are three ways.

For both ways, you'll need the pool imported without automounting it.

sudo zpool import tank -N

A) Modifying The Property

sudo mkdir /mnt/mydataset
sudo zfs set mountpoint=/mnt/mydataset tank/my/dataset
sudo zfs mount tank/my/dataset
# [do stuff in /mnt/mydataset]
# ...
sudo zfs unmount tank/my/dataset
# restore mountpoint so that the other system is able to boot from it
sudo zfs set mountpoint=/ tank/my/dataset

B) Avoid zfs mount

If you find setting the mountpoint back and forth annoying, I've found the following to work too. No guarantees about how hacky this is.

sudo mkdir /mnt/mydataset
sudo mount -t zfs -o zfsutil tank/my/dataset /mnt/mydataset
# [do stuff in /mnt/mydataset]
# ...
sudo umount /mnt/mydataset

Note that I have experienced some problems when I used this option B) to chroot to /mnt/mydataset and then use the zfs commands of the other system. I don't know if these issues are related. As long as you don't do something similar, you should be fine though.

C) altroot

You can specify the altroot property on the pool.

altroot
Alternate root directory. If set, this directory is prepended to any mount points within the pool. This can be used when examining an unknown pool where the mount points cannot be trusted, or in an alternate boot environment, where the typical paths are not valid.
altroot is not a persistent property. It is valid only while the system is up. Setting altroot defaults to using cachefile = none though this may be overridden using an explicit setting.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.