> > > It seems that someone should bring up this issue on the zfs list.  All
> > > of the proposed solutions have involved 'tail -1'.  This is a
> > > non-scalable solution which does not work efficiently for any number
> > > of snapshots.
> >
> > What's wrong with it?
> >
> > Works for me, and although it could be ever so slightly more convenient to
> > have an option to "zfs" command, I don't see anything to gain.  Maybe 6
> > characters less typing...
> >
> > "zfs list -r" scans the whole disk for snapshots, and can take time on a
> disk that has "gone to sleep", or has a large number of snapshots ... it
> just does.
> 
> as it happens when I talked on the zfs list, it is possible to quickly
> search for a specific zfs snapshot, so therefore I can speed up the system
> by positive discrimination, rather than negative.
> 
> zfs list -H pool/slice@snaphost and checking on the failures.

Here's what I wrote:
(You could optionally specify the zvol or filesystem, as you mentioned above)
zfs list -H -o name -t snapshot > $TMPFILE

filesystems=`zfs list -H -o name -t filesystem,volume | egrep -v 
'rpool/dump|rpool/swap'`
for fs in $filesystems ; do 
    latest=`grep "^${fs}@" $TMPFILE | tail -1`

There is nothing wrong with using "tail -1" as Bob said.  If the question 
you're trying to answer, is "what's the latest snapshot of the specified 
filesystem" that's just fine ...  And in fact, the thread is about "Finding the 
last snapshot."

So I'll agree, you might not want to list *all* snapshots on the whole system.  
You might benefit by naming the zvol or filesystem.  But there is still nothing 
wrong with using tail to find the last one.

_______________________________________________
OpenIndiana-discuss mailing list
[email protected]
http://openindiana.org/mailman/listinfo/openindiana-discuss

Reply via email to