2011-07-06 20:21, Cindy Swearingen ?????:
Hi Adrian,

I wonder if you have seen these setup instructions:

http://www.oracle.com/technetwork/articles/servers-storage-dev/autosnapshots-397145.html

Hello Cindy,

I would like to suggest an optimization to this part of the article:

===


     How Do I Delete Unwanted Automatic Snapshots?

Carefully! The following command deletes all snapshots matching the pattern |@zfs-auto-snap|:


#*for s in `zfs list -H -o name -t snapshot | grep @zfs-auto-snap`; do zfs destroy $s ; done*

===

In fact on a system with thousands or tens of thousands of snapshots,
deleting them one-by-one can take hours, literally. Spawning a zfs
process, posting the kernel request to remove a snapshot, and
ultimately queuing some updated ZFS blocks to a transaction group,
and finally mechanically writing this TXG can take a few seconds per
run. Problem is, many of the updated metadatablocks would be
rewritten again and again by further "zfs destroy" invokations.

On my systems, I usually run the "zfs destroy" part in the background
(with an "&"), and also hiding variables in quotemarks is often a good
idea just in case:

#*for s in `zfs list -H -o name -t snapshot | grep @zfs-auto-snap`; do zfs destroy "$s"& done*


While this spawns thousands of processes, an 8Gb+ machine can
in practice handle that. This parallel destroy allows to stuff many
metadata block updates in a single TXG timeframe, coalescing
and cancelling out many writes which are obsoleted before they
make it to mechanical media.

This way destroying 2000-3000 snapshots can be done in under
a minute, or within 5-10 minutes, depending on hardware.

HTH,
//Jim


_______________________________________________
zfs-discuss mailing list
zfs-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/zfs-discuss

Reply via email to