Q. re: zfs clones and promote

Arthur Chance freebsd at qeng-ho.org
Wed Jun 10 16:48:36 UTC 2020

On 10/06/2020 16:54, James B. Byrne via freebsd-questions wrote:
> I am working on a clone of a template jail in IOCAGE. My thoughts were tht if
> things go horribly wrong then I can simply remove the clone and start again
> from the template.  If things work out then I can promote the clone.
> However, I am not clear on the implications of promote.  I just want to go
> thorugh this so that any misapprehension that I have can be corrected:
> 1. A thick jail (X) is created via iocage.
> 2. Jail X is started, has a specific suit of packages installed, and is stopped.
> 3. Jail Xc is cloned from X.
> 4. Jail Xc is started, additional packages added and configured, setup as
> desired for its intended purpose, and stopped.
> Now, I read this in the zfs man page:
>      The clone parent-child dependency relationship can be reversed by using
>      the promote subcommand. This causes the "origin" file system to become a
>      clone of the specified file system, which makes it possible to destroy
>      the file system that the clone was created from.
> The way that this is worded can be interpreted that Xc becomes the file system
> and X the clone of Xc, which can then be destroyed.  What I wish to have is
> both X and Xc as independent zfs file systems.  Is this not possible using
> promote or must I use zfs send to obtain this result?

I read the manual entry as saying that after promote you *can* delete
the original file system but you don't have to. What you have after a
clone is two file systems with one (the clone) being a "side shoot" of
the original that "borrows" the original data, so the original cannot be
destroyed while the clone exists because of the borrowed data, whereas
destroying the clone only deletes back to the fork. This only matters if
you want to destroy one of the two file systems, and promote switches
the original/side shoot relationship so you can choose which file system
you want to delete.

If you need to have two completely independent file systems with no
sharing of data you'll need zfs send | zfs recv to create a copy.

Fat Earther: One who believes the world is round but has put on too
much weight round the middle.

More information about the freebsd-questions mailing list