ZFS What happens if I import another 'zroot' pool while in a ZFS 'zroot' system.

Hi.
I downloaded a VM raw image from remote host for backup. I will destroy that VM but want to check if the image is in good shape, also access it contents.
I could just import the zpool but it's also 'zroot'. Something bad happens if I import it anyway? Or it just fails? Wanted to know beforehand.
It seems I need to import first anyway to be able to change the pool's name.

I think I could boot a rescue pendrive and do this but this computer is the only one I have with space for this backup and it's actual state is quite 'headless'.

I'm curious if it's even possible to have this done without plugin a keyboard and monitor?

Thanks
 
 
Thanks!

Yeah I could boot a rescue pendrive and do this. But more interested to know if possible to do it 'in place' from the running system.
Another option would be booting the image in Bhyve and get access.
Still, curious to know if there's a way to import zroot, and if something bad happens if I just do 'zpool import zroot'. It will probably fail I think.

Would be nice if some option existed to 'zpool import' while renaming at same time.
 
I downloaded a VM raw image from remote host for backup. I will destroy that VM but want to check if the image is in good shape, also access it contents.
I could just import the zpool but it's also 'zroot'. Something bad happens if I import it anyway? Or it just fails? Wanted to know beforehand.
It seems I need to import first anyway to be able to change the pool's name.
You can import it with an new name. See zpool-import(8)
 
But be aware that there's a danger that filesystems from the imported pool could be mounted on top of your working system, BTDTGTTS.

Consider using the -R option of zpool import to specify a different mount point for the imported system
Yes, and one can import with no-mount option -N.
 
I used the command with the -N option, changed the 'default' / and all fine.
It looks strange if the new pool is able to (S)teal, or mix within, the already mounted '/'

[or, who knows the gears behind bectl and infact cause issues?]

This is maybe a good thing to test in a VM to watch what happens
 
FYI:
I have 2 Root-on-ZFS pools in different physical drives. One is stable/14 for daily use and another is main (aka current) for test and rescue. Each has /home dataset, and one on main environment is the backup for stable/14.
I daily import main environment (pool) under /mnt using zfs import -R, then, zfs send and recv to transfer latest snapshot.
Importing with -R option to some mountpoint should be the safest to import Root-on-ZFS pool to another.
 
It looks strange if the new pool is able to (S)teal, or mix within, the already mounted '/'
I wouldn't say it is actually "stealing". It is an expected behavior - if you mount a dataset with the same mount point after one has already been mounted, the first mount will become hidden and all reads and writes will go the the last mount. So, One should be careful doing this. If you import one working system to another working system, you probably do not want to write to it. Using snapshots will give some security in that case.

I have been using this for cloning a working FreeBSD system in case the cloned drive is smaller than the original. I have a small boot system on SSD. Then I take one drive with the original bootable system and an empty (smaller) drive. Import the original ZFS pool with no-mount, usually the recursive snapshot has already been done. Then partition the new drive and create an empty ZFS pool on it (usually also adding the UEFI boot in one of the new partitions). Transfer the system from original, using zfs send (zfs-send(8)) and zfs receive (zfs-receive(8)). Set the bootable flag for the root dataset on the copy. Export, disconnect and here you go!

The benefits of doing this is that I can migrate a working system to a smaller drive than the original if there is free space on it. (To clone a system to a drive with a same or bigger size, using ZFS mirroring and resilver is much faster and easier.)
 
Back
Top