Resetting zfs snapshots
dch at skunkwerks.at
Thu Feb 22 23:00:36 UTC 2018
On Thu, 22 Feb 2018, at 22:29, James B. Byrne via freebsd-questions wrote:
> I am in the process of setting up a new FreeBSD server which involves
> transferring a large amount of data onto. The system was installed
> with root zfs and snapshots were initialised immediately.
> Several iterations of test data transfer and deletes has now resulted
> in snapshots exceeding 64 Gb. I wish to effectively restart/rebase
> snapshots following the final transfer and eliminate all previous
> What is the safest way to do this?
-read the manpage for `zfs destroy` carefully ;-) and make a backup.
start off using:
zfs destroy -vn zroot/path/to/dataset at first-snapshot%last-snapshot
the -n ensures it only displays what it *would* do, but actually makes
the @first%last is an inclusive range so the destruction would include:
- everything in between
You may want -r which does this same range destruction for all
If your goal is to *recursively* nuke all snapshots prior to "now" then you can:
# make a snapshot right now that will be destroyed in the inclusive range
zfs snapshot -r zroot at before
# this snapshot will live on in infamy long after its comrades are gone
zfs snapshot -r zroot at now
# use the inclusive range to trash all preceding snapshots
zfs destroy -vrn zroot@%before
# at this point a backup is a really good idea
zfs send -LevR zroot at now > somewhere/with/space
I highly recommend Jude + Lucas' zfs books, well worth every penny.
Also, if you're not using boot environments, start now. they are the best
thing since zfs. You have a good opportunity to test these out before your
system is live.
More information about the freebsd-questions