Alexander Skwar
2009-Dec-11 07:37 UTC
[zfs-discuss] Doing ZFS rollback with preserving later created clones/snapshot?
Hi. Is it possible on Solaris 10 5/09, to rollback to a ZFS snapshot, WITHOUT destroying later created clones or snapshots? Example: --($ ~)-- sudo zfs snapshot rpool/ROOT at 01 --($ ~)-- sudo zfs snapshot rpool/ROOT at 02 --($ ~)-- sudo zfs clone rpool/ROOT at 02 rpool/ROOT-02 --($ ~)-- LC_ALL=C sudo zfs rollback rpool/ROOT at 01 cannot rollback to ''rpool/ROOT at 01'': more recent snapshots exist use ''-r'' to force deletion of the following snapshots: rpool/ROOT at 02 So it isn''t as simple as that. But what needs to be done, to preserve rpool/ROOT-02? Actually, I''m not concerned (that much) with preserving the clone rpool/ROOT-02. But I''d like to keep the contents of rpool/ROOT as it was when I created the @02 snapshot. Is the only possible way to create a backup of rpool/ROOT at 02 (eg. of the snapshot directory /rpool/ROOT/.zfs/snapshots/02) and then restore it later on (eg. backup to tape, backup to someother filesystem using zfs send|recv, rsync, tar, ...)? Thanks a lot, Alexander -- ? Keine Internetzensur in Deutschland! ? http://zensursula.net ? ? ?? ? Lifestream (Twitter, Blog, ?) ??http://alexs77.soup.io/ ? ? ? ? Chat (Jabber/Google Talk) ? a.skwar at gmail.com , AIM: alexws77 ??
Jeff Bonwick
2009-Dec-11 07:45 UTC
[zfs-discuss] Doing ZFS rollback with preserving later created clones/snapshot?
Yes, although it''s slightly indirect: - make a clone of the snapshot you want to roll back to - promote the clone See ''zfs promote'' for details. Jeff On Fri, Dec 11, 2009 at 08:37:04AM +0100, Alexander Skwar wrote:> Hi. > > Is it possible on Solaris 10 5/09, to rollback to a ZFS snapshot, > WITHOUT destroying later created clones or snapshots? > > Example: > > --($ ~)-- sudo zfs snapshot rpool/ROOT at 01 > > --($ ~)-- sudo zfs snapshot rpool/ROOT at 02 > > --($ ~)-- sudo zfs clone rpool/ROOT at 02 rpool/ROOT-02 > > --($ ~)-- LC_ALL=C sudo zfs rollback rpool/ROOT at 01 > cannot rollback to ''rpool/ROOT at 01'': more recent snapshots exist > use ''-r'' to force deletion of the following snapshots: > rpool/ROOT at 02 > > So it isn''t as simple as that. But what needs to be done, to preserve > rpool/ROOT-02? > > Actually, I''m not concerned (that much) with preserving the clone > rpool/ROOT-02. But I''d like to keep the contents of rpool/ROOT as > it was when I created the @02 snapshot. > > Is the only possible way to create a backup of rpool/ROOT at 02 (eg. > of the snapshot directory /rpool/ROOT/.zfs/snapshots/02) and then > restore it later on (eg. backup to tape, backup to someother filesystem > using zfs send|recv, rsync, tar, ...)? > > Thanks a lot, > > Alexander > -- > ? Keine Internetzensur in Deutschland! ? http://zensursula.net ? ? > ?? ? Lifestream (Twitter, Blog, ?) ??http://alexs77.soup.io/ ? ? ? > ? Chat (Jabber/Google Talk) ? a.skwar at gmail.com , AIM: alexws77 ?? > _______________________________________________ > zfs-discuss mailing list > zfs-discuss at opensolaris.org > http://mail.opensolaris.org/mailman/listinfo/zfs-discuss
Alexander Skwar
2009-Dec-11 09:17 UTC
[zfs-discuss] Doing ZFS rollback with preserving later created clones/snapshot?
Hello Jeff! Could you (or anyone else, of course *G*) please show me how? Situation: There shall be 2 snapshots of a ZFS called rpool/rb-test Let''s call those snapshots "01" and "02". $ sudo zfs create rpool/rb-test $ zfs list rpool/rb-test NAME USED AVAIL REFER MOUNTPOINT rpool/rb-test 18K 170G 18K /rpool/rb-test $ sudo zfs snapshot rpool/rb-test at 01 $ sudo zfs snapshot rpool/rb-test at 02 $ sudo zfs clone rpool/rb-test at 02 rpool/rb-test-02 $ sudo zfs promote rpool/rb-test-02 $ zfs list -r rpool | grep rb-test rpool/rb-test 0 170G 18K /rpool/rb-test rpool/rb-test-02 18K 170G 18K /rpool/rb-test-02 rpool/rb-test-02 at 01 0 - 18K - rpool/rb-test-02 at 02 0 - 18K - Now, what do I need to do, so that I get rpool/rb-test back to where it was when the snapshot rpool/rb-test at 01 was created, but WITHOUT losing what''s at rpool/rb-test at 02? As there''s no rpool/rb-test at 01, I obviously can''t do a zfs rollback rpool/rb-test at 01. I suppose I might be able to do "zfs rollback rpool/rb-test-02 at 01", but that would destroy rpool/rb-test-02 at 02, wouldn''t it? Could you please be so kind and show what exactly needs to be done? Thanks a lot, Alexander On Fri, Dec 11, 2009 at 08:45, Jeff Bonwick <Jeff.Bonwick at sun.com> wrote:> Yes, although it''s slightly indirect: > > - make a clone of the snapshot you want to roll back to > - promote the clone > > See ''zfs promote'' for details. > > Jeff > > On Fri, Dec 11, 2009 at 08:37:04AM +0100, Alexander Skwar wrote: > > Hi. > > > > Is it possible on Solaris 10 5/09, to rollback to a ZFS snapshot, > > WITHOUT destroying later created clones or snapshots? > > > > Example: > > > > --($ ~)-- sudo zfs snapshot rpool/ROOT at 01 > > > > --($ ~)-- sudo zfs snapshot rpool/ROOT at 02 > > > > --($ ~)-- sudo zfs clone rpool/ROOT at 02 rpool/ROOT-02 > > > > --($ ~)-- LC_ALL=C sudo zfs rollback rpool/ROOT at 01 > > cannot rollback to ''rpool/ROOT at 01'': more recent snapshots exist > > use ''-r'' to force deletion of the following snapshots: > > rpool/ROOT at 02 > > > > So it isn''t as simple as that. But what needs to be done, to preserve > > rpool/ROOT-02? > > > > Actually, I''m not concerned (that much) with preserving the clone > > rpool/ROOT-02. But I''d like to keep the contents of rpool/ROOT as > > it was when I created the @02 snapshot. > > > > Is the only possible way to create a backup of rpool/ROOT at 02 (eg. > > of the snapshot directory /rpool/ROOT/.zfs/snapshots/02) and then > > restore it later on (eg. backup to tape, backup to someother filesystem > > using zfs send|recv, rsync, tar, ...)? > > > > Thanks a lot, > > > > Alexander > > -- > > ? Keine Internetzensur in Deutschland! ? http://zensursula.net ? ? > > ?? ? Lifestream (Twitter, Blog, ?) ??http://alexs77.soup.io/ ? ? ? > > ? Chat (Jabber/Google Talk) ? a.skwar at gmail.com , AIM: alexws77 ?? > > _______________________________________________ > > zfs-discuss mailing list > > zfs-discuss at opensolaris.org > > http://mail.opensolaris.org/mailman/listinfo/zfs-discuss >-- Alexander -- ? Keine Internetzensur in Deutschland! ? http://zensursula.net ? ? ? Lifestream (Twitter, Blog, ?) ? http://alexs77.soup.io/ ? ? Chat (Jabber/Google Talk) ? a.skwar at gmail.com , AIM: alexws77 ? Sent from Winterthur, ZH, Switzerland -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.opensolaris.org/pipermail/zfs-discuss/attachments/20091211/7d4b5418/attachment.html>
Ross Walker
2009-Dec-11 14:35 UTC
[zfs-discuss] Doing ZFS rollback with preserving later created clones/snapshot?
On Dec 11, 2009, at 4:17 AM, Alexander Skwar <alexanders.mailinglists+nospam at gmail.com > wrote:> Hello Jeff! > > Could you (or anyone else, of course *G*) please show me how? > > Situation: > > There shall be 2 snapshots of a ZFS called rpool/rb-test > Let''s call those snapshots "01" and "02". > > $ sudo zfs create rpool/rb-test > > $ zfs list rpool/rb-test > NAME USED AVAIL REFER MOUNTPOINT > rpool/rb-test 18K 170G 18K /rpool/rb-test > > $ sudo zfs snapshot rpool/rb-test at 01 > $ sudo zfs snapshot rpool/rb-test at 02 > $ sudo zfs clone rpool/rb-test at 02 rpool/rb-test-02 > $ sudo zfs promote rpool/rb-test-02 > $ zfs list -r rpool | grep rb-test > rpool/rb-test 0 > 170G 18K /rpool/rb-test > rpool/rb-test-02 18K > 170G 18K /rpool/rb-test-02 > rpool/rb-test-02 at 01 0 > - 18K - > rpool/rb-test-02 at 02 0 > - 18K - > > Now, what do I need to do, so that I get rpool/rb-test > back to where it was when the snapshot rpool/rb-test at 01 > was created, but WITHOUT losing what''s at rpool/rb-test at 02? > > As there''s no rpool/rb-test at 01, I obviously can''t do a > zfs rollback rpool/rb-test at 01. > > I suppose I might be able to do "zfs rollback rpool/rb-test-02 at 01", > but that would destroy rpool/rb-test-02 at 02, wouldn''t it? > > Could you please be so kind and show what exactly > needs to be done?I think you might be confused at what happens when you promote a cloned file system. When it is promoted the clone becomes the file system and the original becomes the clone. In this manner you are rolling back to the snapshot, but preserving the original as a clone and keeping the other snapshots as snapshots of the clone, you just might need to fix mountpoints and/or rename file systems to suit your taste. If you "pivot" clones, sub-clones and their snapshots too many times you really will make accounting difficult and zfs destroy will take a long time to unwind the references, so use sparingly and clean up unused references when you can. -Ross
Fajar A. Nugraha
2009-Dec-11 14:55 UTC
[zfs-discuss] Doing ZFS rollback with preserving later created clones/snapshot?
On Fri, Dec 11, 2009 at 4:17 PM, Alexander Skwar <alexanders.mailinglists+nospam at gmail.com> wrote:> $ sudo zfs create rpool/rb-test > > $ zfs list rpool/rb-test > NAME??????????? USED? AVAIL? REFER? MOUNTPOINT > rpool/rb-test??? 18K?? 170G??? 18K? /rpool/rb-test > > $ sudo zfs snapshot rpool/rb-test at 01 > $ sudo zfs snapshot rpool/rb-test at 02 > $ sudo zfs clone rpool/rb-test at 02 rpool/rb-test-02at this point it might be better to do some rename and clone $ sudo zfs rename rpool/rb-test rpool/rb-test-orig $ sudo zfs clone rpool/rb-test-orig at 01 rpool/rb-test -- Fajar
Alexander Skwar
2009-Dec-11 20:18 UTC
[zfs-discuss] Doing ZFS rollback with preserving later created clones/snapshot?
Hi. On Fri, Dec 11, 2009 at 15:35, Ross Walker <rswwalker at gmail.com> wrote:> On Dec 11, 2009, at 4:17 AM, Alexander Skwar > <alexanders.mailinglists+nospam at gmail.com> wrote: > >> Hello Jeff! >> >> Could you (or anyone else, of course *G*) please show me how?[...]>> Could you please be so kind and show what exactly >> needs to be done? > > I think you might be confusedActually, I rather think that I might not have been clear enough, which then confused you? :)> at what happens when you promote a cloned file > system. When it is promoted the clone becomes the file system and the > original becomes the clone.Sure. But how does one then rollback to fs at snap-01?> In this manner you are rolling back to the > snapshot,Yes. Allright, and how do I actually do what I asked for? :) Please do: # chose one of the following - or even none, if done as # root root_exec=pfexec root_exec=sudo $root_exec zfs create rpool/rbtest $root_exec zfs set mountpoint=/rbtest rpool/rbtest echo 1 | $root_exec dd of=/rbtest/status $root_exec zfs snapshot rpool/rbtest at 01 echo 2 | $root_exec dd of=/rbtest/status $root_exec zfs snapshot rpool/rbtest at 02 $root_exec zfs clone rpool/rbtest at 02 rpool/rbtest-02 $root_exec zfs promote rpool/rbtest-02 --($ ~)-- zfs list | grep rbt rpool/rbtest 0 170G 19.5K /rbtest rpool/rbtest-02 52K 170G 19.5K /rpool/rbtest-02 rpool/rbtest-02 at 01 16.5K - 19.5K - rpool/rbtest-02 at 02 16K - 19.5K - Now /rbtest/status contains 2 and so does /rpool/rbtest-02/status: --($ ~)-- cat /rbtest/status /rpool/rbtest-02/status 2 2 What do I need to do, so /rbtest/status contains 1 (besides doing something like "echo 1 | sudo dd of=/rbtest/status", of course *G*) and /rpool/rbtest-02/status (or whatever) is 2? It is important that /rbtest/status has exactly that path. Could you (or anyone? *g*) explain (or better yet: show the commands)?> but preserving the original as a clone and keeping the other > snapshots as snapshots of the clone, you just might need to fix mountpoints > and/or rename file systems to suit your taste.How? --($ ~)-- sudo zfs rename rpool/rbtest-02 at 01 rpool/rbtest at 01 cannot rename to ''rpool/rbtest at 01'': snapshots must be part of same dataset I did that, thinking/hoping that this would then allow me to do a "zfs rollback rpool/rbest at 01". Alexander -- ? Keine Internetzensur in Deutschland! ? http://zensursula.net ? ? ?? Lifestream (Twitter, Blog, ?) ??http://alexs77.soup.io/ ? ? Chat (Jabber/Google Talk) ? a.skwar at gmail.com , AIM: alexws77 ?
Alexander Skwar
2009-Dec-11 20:26 UTC
[zfs-discuss] Doing ZFS rollback with preserving later created clones/snapshot?
Hi! On Fri, Dec 11, 2009 at 15:55, Fajar A. Nugraha <fajar at fajar.net> wrote:> On Fri, Dec 11, 2009 at 4:17 PM, Alexander Skwar > <alexanders.mailinglists+nospam at gmail.com> wrote: >> $ sudo zfs create rpool/rb-test >> >> $ zfs list rpool/rb-test >> NAME??????????? USED? AVAIL? REFER? MOUNTPOINT >> rpool/rb-test??? 18K?? 170G??? 18K? /rpool/rb-test >> >> $ sudo zfs snapshot rpool/rb-test at 01 >> $ sudo zfs snapshot rpool/rb-test at 02 >> $ sudo zfs clone rpool/rb-test at 02 rpool/rb-test-02 > > at this point it might be better to do some rename and clone > > $ sudo zfs rename rpool/rb-test rpool/rb-test-orig > $ sudo zfs clone rpool/rb-test-orig at 01 rpool/rb-testAH! Now I understand! The crucial point here is the "zfs rename", which "moves" the original stuff out of the way and then whatever data is required (eg snap @01 or @02) is "moved" to the correct spot by cloning the wanted snapshot. That''s quite clever - thanks a lot! It''s clear now. But this has the "chance" of becoming rather confusing if too many snapshots or "branches" are used. But that''s the way it is? :-) Thanks again. Cheers, Alexander -- ? Keine Internetzensur in Deutschland! ? http://zensursula.net ? ? ?? Lifestream (Twitter, Blog, ?) ??http://alexs77.soup.io/ ? ? Chat (Jabber/Google Talk) ? a.skwar at gmail.com , AIM: alexws77 ? Sent from Winterthur, ZH, Switzerland
Ross Walker
2009-Dec-12 01:21 UTC
[zfs-discuss] Doing ZFS rollback with preserving later created clones/snapshot?
On Dec 11, 2009, at 3:26 PM, Alexander Skwar <alexanders.mailinglists+nospam at gmail.com > wrote:> Hi! > > On Fri, Dec 11, 2009 at 15:55, Fajar A. Nugraha <fajar at fajar.net> > wrote: >> On Fri, Dec 11, 2009 at 4:17 PM, Alexander Skwar >> <alexanders.mailinglists+nospam at gmail.com> wrote: >>> $ sudo zfs create rpool/rb-test >>> >>> $ zfs list rpool/rb-test >>> NAME USED AVAIL REFER MOUNTPOINT >>> rpool/rb-test 18K 170G 18K /rpool/rb-test >>> >>> $ sudo zfs snapshot rpool/rb-test at 01 >>> $ sudo zfs snapshot rpool/rb-test at 02 >>> $ sudo zfs clone rpool/rb-test at 02 rpool/rb-test-02 >> >> at this point it might be better to do some rename and clone >> >> $ sudo zfs rename rpool/rb-test rpool/rb-test-orig >> $ sudo zfs clone rpool/rb-test-orig at 01 rpool/rb-test > > AH! > > Now I understand! > > The crucial point here is the "zfs rename", which > "moves" the original stuff out of the way and then > whatever data is required (eg snap @01 or @02) > is "moved" to the correct spot by cloning the wanted > snapshot. > > That''s quite clever - thanks a lot! It''s clear now. > > But this has the "chance" of becoming rather confusing > if too many snapshots or "branches" are used. But > that''s the way it is? :-)Juliet: "What''s in a name? That which we call a rose By any other name would smell as sweet." Romeo and Juliet (II, ii, 1-2) -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.opensolaris.org/pipermail/zfs-discuss/attachments/20091211/0497eebc/attachment.html>