zfs promote - not only for stars...

| | Comments (0) | TrackBacks (0)
Just in case you don't know: Solaris ZFS knows the concept of "promoting" a clone to become a primary filesystem.

Imagine you did a clone of a big database filesystem running in another rdbms instance.
Now you want to use that clone as production file system and you don't need the original file system any more. This won't work because the clone DEPENDS on the original filesystem.

To change that, simply use the promote command to reverse the dependency between clone and original.

Example:

# zfs snapshot mypool/rdbmsdata@snap1

We just created a snapshot of the rdbmsdata filesystem.
Now let's make a clone:

# zfs clone mypool/rdbmsdata@snap1 mypool/rdbmsclone

Result:

mypool/rdbmsclone                                  0   149G   371M  /mypool/rdbmsclone
mypool/rdbmsdata                                371M   149G   371M  /mypool/rdbmsdata
mypool/rdbmsdata@snap1                             0      -   371M  -

As you can see, the clone "rdbmsclone" does not need any space - we did not change anything, it does not differ from its parent "rdbmsdata".

In case you want to delete "rdbmsclone" the system will refuse - it will ask you to bury rdbmsclone as well, because rdbmsclone is dependent on rdbmsdata.

To revert this depency, just type:

# zfs promote mypool/rdbmsclone

Result:

mypool/rdbmsclone                               371M   149G   371M  /mypool/rdbmsclone
mypool/rdbmsclone@snap1                            0      -   371M  -
mypool/rdbmsdata                                   0   149G   371M  /mypool/rdbmsdata

Watch the snapshot "snap1". It became a snaphot of "rdbmsclone".
Now it's possible to destroy "rdbmsdata" as it became in turn dependent on "rdbmsclone":

# zfs destroy mypool/rdbmsdata

And it has gone:

mypool/rdbmsclone                               371M   149G   371M  /mypool/rdbmsclone
mypool/rdbmsclone@snap1                            0      -   371M  -

Not rocket science, but worth noting. And a big timesaver in many circumstances when doing upgrades, version tests or benchmarks with different versions.

0 TrackBacks

Listed below are links to blogs that reference this entry: zfs promote - not only for stars....

TrackBack URL for this entry: http://southbrain.com/mt/mt-tb.cgi/81

Leave a comment

July 2012

Sun Mon Tue Wed Thu Fri Sat
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31        

About

This blog is owned by:

Pascal Gienger
Jägerstrasse 77
8406 Winterthur
Switzerland


Google+: Profile
YouTube Channel: pascalgienger