ZFS send/recv and overwriting of existing mounts

From: Thomas Backman <serenity_at_exscape.org>
Date: Fri, 5 Jun 2009 15:09:21 +0200
Hey all,
I was wondering if there could (should?) be some kind of protection of  
over-mounting/shadowing (whatever the term is; overriding an existing  
mount) in ZFS.

Take this as an example (from my memory, as the shell history is gone  
due to the forceful shutdown):
zfs create tank/test
zfs snapshot tank/root_at_now
zfs send -R tank/root_at_now | zfs recv -vf tank/test
... bam, you now have two filesystems mounted on /, an empty /dev  
directory unless you double-mount devfs as well, etc.
Reboot, and the same thing happens - it mounts root from /boot/ 
loader.conf, then rc.conf executes and mounts the tank/test root copy  
over /, again hiding /dev and making your system non-bootable.
The only solution I've found so far is to reboot to livefs and destroy  
the copy... Ugh. I was just gonna test to see if send -R worked on  
vanilla sources now (I've had to use a patch previously), which it  
did, but I didn't expect it to override my root!
(Single-user might have worked, now that I think about it; still, that  
too requires downtime to fix something that shouldn't really happen.)

I guess you COULD file this under the "feature, not a bug" section,  
but in cases like this, I'd say "bug".

Regards,
Thomas
Received on Fri Jun 05 2009 - 11:09:42 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:49 UTC