Deleting the top-level ZFS file system (without affecting its children)
Ronald Klop
ronald-freebsd8 at klop.yi.org
Fri Jan 11 15:32:29 UTC 2013
On Fri, 11 Jan 2013 16:11:32 +0100, xenophon\+freebsd
<xenophon+freebsd at irtnog.org> wrote:
> When I originally set up ZFS on my server, I used the topmost file
> system for the root file system. Last night, I used "zfs send" and "zfs
> recv" to create a new root file system named "zroot/root". Then, I
> adjusted the mount points in single-user mode. Based on my reading of
> the contents of src/sys/boot/zfs/ and src/sys/boot/i386/zfsboot/
> (specifically the zfs_mount() and zfs_get_root() functions in
> zfsimpl.c), I ran "zpool set bootfs=zroot/root zroot". This should
> allow the boot program to find the new root file system.
>
> Now, I'd like to delete the old root file system and return its storage
> to the pool. Clearly, "rm -rf /oldroot/*" wouldn't return the space
> already allocated to the old root file system, but I don't want to run
> "zfs destroy zroot", as that will probably affect its children (the
> whole rest of the pool). At this point, I suspect that I'd have to
> re-create the pool to get the desired configuration.
>
> Is my understanding correct?
>
> Right now, the pool's datasets look something like the following:
>
> xenophon at cinep001bsdgw:~>zfs list
> NAME USED AVAIL REFER MOUNTPOINT
> zroot 75.5G 143G 1.04G /oldroot
> zroot/root 1.04G 143G 1.03G /
> zroot/usr 28.6G 143G 10.2G /usr
> (etc.)
>
> Best wishes,
> Matthew
>
Why would rm -rf /oldroot/* not return all the allocated space?
I can only think of snapshots keeping the space allocated, but you can
remove those too.
Can you elaborate on that?
Ronald.
More information about the freebsd-stable
mailing list