Hi, # uname -a SunOS sc420 5.11 snv_33 i86pc i386 i86pc First, is there a way to list all the snapshots created for a particular filesystem, without using the ''grep'' like command? For example, it seems I need to do: # zfs list -t snapshot -o name,creation | grep ^share/safe share/safe at 02072006 Tue Feb 7 23:14 2006 share/safe at 02282006 Tue Feb 28 23:28 2006 No big deal though. I want to compare the creation time of each snapshot, although I imagine most users will use date as part of the snapshot name. Interestingly, if I do ''ls'' in the snapshot directory, they all show the same date/time: /share/safe/.zfs/snapshot # ls total 4 drwxrwxrwx 4 root root 4 Feb 7 23:11 02282006 drwxr-xr-x 4 root sys 4 Feb 7 23:11 02072006 Turns out it''s the date for the mount point: /share # ls drwxrwxrwx 4 root root 4 Feb 7 23:11 safe I also noticed the manpage isn''t quite right on "-t type": -t type A comma-separated list of types to display, where "type" is one of "fs", "snap" or "vol". For example the command "-t snap" displays only snapshots. Actually I can only use "filesystem", "snapshot" and "volume" : # zfs list -t snap invalid type ''snap'' ... The stderr message from zfs is correct: The following properties are supported: PROPERTY EDIT INHERIT VALUES type NO NO filesystem | volume | snapshot Not sure if it''s fixed in later build. Thanks, Tao -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.opensolaris.org/pipermail/zfs-discuss/attachments/20060308/42ef1461/attachment.html>
Tao Chen wrote:> Hi, > > # uname -a > SunOS sc420 5.11 snv_33 i86pc i386 i86pc > > First, is there a way to list all the snapshots created for a particular > filesystem, without using the ''grep'' like command?yes.> For example, it seems I need to do: > > # zfs list -t snapshot -o name,creation | grep ^share/safe > share/safe at 02072006 Tue Feb 7 23:14 2006 > share/safe at 02282006 Tue Feb 28 23:28 2006$ zfs list -r -t snapshot -o name,creation cube/builds/onnv-clone NAME CREATION cube/builds/onnv-clone at 2005-12-14 Wed Dec 14 8:20 2005 cube/builds/onnv-clone at 2005-12-15 Thu Dec 15 5:50 2005 cube/builds/onnv-clone at 2005-12-16 Fri Dec 16 4:14 2005 cube/builds/onnv-clone at 2005-12-17 Sat Dec 17 4:13 2005 cube/builds/onnv-clone at 2005-12-18 Sun Dec 18 4:09 2005 cube/builds/onnv-clone at 2005-12-19 Mon Dec 19 4:14 2005 cube/builds/onnv-clone at 2005-12-20 Tue Dec 20 4:13 2005 cube/builds/onnv-clone at 2005-12-21 Wed Dec 21 4:15 2005 cube/builds/onnv-clone at 2005-12-22 Thu Dec 22 4:20 2005 cube/builds/onnv-clone at 2005-12-23 Fri Dec 23 4:17 2005 ..... cube/builds/onnv-clone at 2006-03-08 Wed Mar 8 8:50 2006 -- Darren J Moffat
On 3/9/06, Darren J Moffat <Darren.Moffat at sun.com> wrote:> > Tao Chen wrote: > > > First, is there a way to list all the snapshots created for a particular > > filesystem, without using the ''grep'' like command? > > yes. > > $ zfs list -r -t snapshot -o name,creation cube/builds/onnv-clone > NAME CREATION > cube/builds/onnv-clone at 2005-12-14 Wed Dec 14 8:20 2005 >Thanks Darren. I missed the -r flag. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.opensolaris.org/pipermail/zfs-discuss/attachments/20060309/45676df3/attachment.html>
On Thu, Mar 09, 2006 at 09:01:40AM -0600, Tao Chen wrote:> > Thanks Darren. I missed the -r flag.Note that this will always recurse over all children, so if you imagine: tank/home tank/home at now tank/home/eschrock tank/home/eschrock at then Then there''s no simple way to get just the snapshots for ''tank/home at now''. There is an open RFE to only show direct descendents of a dataset. - Eric -- Eric Schrock, Solaris Kernel Development http://blogs.sun.com/eschrock
On 3/9/06, Eric Schrock <eric.schrock at sun.com> wrote:> > On Thu, Mar 09, 2006 at 09:01:40AM -0600, Tao Chen wrote: > > > > Thanks Darren. I missed the -r flag. > > Note that this will always recurse over all children, so if you imagine: > > tank/home > tank/home at now > tank/home/eschrock > tank/home/eschrock at then > > Then there''s no simple way to get just the snapshots for > ''tank/home at now''. There is an open RFE to only show direct descendents > of a dataset. >Good to know there''s a RFE. I can see the need. Thanks. Tao -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.opensolaris.org/pipermail/zfs-discuss/attachments/20060309/283ad500/attachment.html>
> > I want to compare the creation time of each snapshot, although I > imagine most users will use date as part of the snapshot name. > Interestingly, if I do ''ls'' in the snapshot directory, they all show > the same date/time: > > /share/safe/.zfs/snapshot # ls > total 4 > drwxrwxrwx 4 root root 4 Feb 7 23:11 02282006 > drwxr-xr-x 4 root sys 4 Feb 7 23:11 02072006 > > Turns out it''s the date for the mount point: > > /share # ls > drwxrwxrwx 4 root root 4 Feb 7 23:11 safe >Its actually the mtime for the mount point at the time the snapshot is created: fsh-mullet# zpool create z c0t1d0 fsh-mullet# ls -aE /z total 3 drwxr-xr-x 2 root sys 2 2006-03-10 18:50:12.385782395 -0800 . drwxr-xr-x 46 root root 1024 2006-03-10 18:50:12.381853000 -0800 .. dr-xr-xr-x 3 root root 3 2006-03-10 18:50:12.385782395 -0800 .zfs fsh-mullet# fsh-mullet# zfs snapshot z at snap1 fsh-mullet# ls -aE /z/.zfs/snapshot total 2 dr-xr-xr-x 2 root root 2 2006-03-10 18:50:12.385782395 -0800 . dr-xr-xr-x 3 root root 3 2006-03-10 18:50:12.385782395 -0800 .. drwxr-xr-x 2 root sys 2 2006-03-10 18:50:12.385782395 -0800 snap1 fsh-mullet# In the above, we see the mtime for "snap1" and "z" to be the same. Now if we modify "z", it will update its mtime, but "snap1" will not: fsh-mullet# mkdir /z/subdir fsh-mullet# ls -aE /z total 6 drwxr-xr-x 3 root sys 3 2006-03-10 18:51:03.179348930 -0800 . drwxr-xr-x 46 root root 1024 2006-03-10 18:50:12.381853000 -0800 .. dr-xr-xr-x 3 root root 3 2006-03-10 18:50:12.385782395 -0800 .zfs drwxr-xr-x 2 root root 2 2006-03-10 18:51:03.179245763 -0800 subdir fsh-mullet# ls -aE /z/.zfs/snapshot total 2 dr-xr-xr-x 3 root root 3 2006-03-10 18:50:12.385782395 -0800 . dr-xr-xr-x 3 root root 3 2006-03-10 18:50:12.385782395 -0800 .. drwxr-xr-x 2 root sys 2 2006-03-10 18:50:12.385782395 -0800 snap1 fsh-mullet# Now if we take another snapshot, it will have a different mtime than "snap1": fsh-mullet# zfs snapshot z at snap2 fsh-mullet# ls -aE /z/.zfs/snapshot total 4 dr-xr-xr-x 3 root root 3 2006-03-10 18:50:12.385782395 -0800 . dr-xr-xr-x 3 root root 3 2006-03-10 18:50:12.385782395 -0800 .. drwxr-xr-x 2 root sys 2 2006-03-10 18:50:12.385782395 -0800 snap1 drwxr-xr-x 3 root sys 3 2006-03-10 18:51:03.179348930 -0800 snap2 fsh-mullet# eric
On 3/10/06, eric kustarz <eric.kustarz at sun.com> wrote:> > > > > > I want to compare the creation time of each snapshot, although I > > imagine most users will use date as part of the snapshot name. > > Interestingly, if I do ''ls'' in the snapshot directory, they all show > > the same date/time: > > > > /share/safe/.zfs/snapshot # ls > > total 4 > > drwxrwxrwx 4 root root 4 Feb 7 23:11 02282006 > > drwxr-xr-x 4 root sys 4 Feb 7 23:11 02072006 > > > > Turns out it''s the date for the mount point: > > > > /share # ls > > drwxrwxrwx 4 root root 4 Feb 7 23:11 safe > > > > Its actually the mtime for the mount point at the time the snapshot is > created: >I figured that out, but thanks for the detailed explanation. Also, I''d suggest put a list-snapshots-creation-time" command as an example in the zfs manpage and/or Guide, it took me more than 10 mins to find out exactly how to do this (supposedly common) operation. BTW, I suppose the manpage error mentioned in my first post will be (or already) fixed. Tao -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.opensolaris.org/pipermail/zfs-discuss/attachments/20060310/cff9af16/attachment.html>
Yes, the zfs man page will be updated to reflect the correct the zfs -t snapshot syntax. I''ll also include an example of displaying the snapshot creation time in the ZFS admin guide. Looks for the updated versions of both docs to appear soon. Thanks for the feedback. Cindy Tao Chen wrote:> > On 3/10/06, *eric kustarz* <eric.kustarz at sun.com > <mailto:eric.kustarz at sun.com>> wrote: > > > > > > I want to compare the creation time of each snapshot, although I > > imagine most users will use date as part of the snapshot name. > > Interestingly, if I do ''ls'' in the snapshot directory, they all show > > the same date/time: > > > > /share/safe/.zfs/snapshot # ls > > total 4 > > drwxrwxrwx 4 root root 4 Feb 7 23:11 02282006 > > drwxr-xr-x 4 root sys 4 Feb 7 23:11 02072006 > > > > Turns out it''s the date for the mount point: > > > > /share # ls > > drwxrwxrwx 4 root root 4 Feb 7 23:11 safe > > > > Its actually the mtime for the mount point at the time the snapshot is > created: > > > I figured that out, but thanks for the detailed explanation. > > Also, I''d suggest put a list-snapshots-creation-time" command as an > example in the zfs manpage and/or Guide, > it took me more than 10 mins to find out exactly how to do this > (supposedly common) operation. > > BTW, I suppose the manpage error mentioned in my first post will be (or > already) fixed. > > Tao > > > ------------------------------------------------------------------------ > > _______________________________________________ > zfs-discuss mailing list > zfs-discuss at opensolaris.org > http://mail.opensolaris.org/mailman/listinfo/zfs-discuss