Skip to content

Instantly share code, notes, and snippets.

@alexjj
Created April 15, 2015 17:09
Show Gist options
  • Select an option

  • Save alexjj/4de71ddfae05e974c829 to your computer and use it in GitHub Desktop.

Select an option

Save alexjj/4de71ddfae05e974c829 to your computer and use it in GitHub Desktop.
Delete all ZFS Snapshots
zfs list -H -o name -t snapshot | xargs -n1 zfs destroy
@alexjj

alexjj commented Jun 26, 2017

Copy link
Copy Markdown
Author

add -r poolname after snapshot to pick a particular dataset.

@TheMayhem6328

Copy link
Copy Markdown

Doesn't work on Ubuntu 20.04
cannot destroy snapshots: permission denied

@alexjj

alexjj commented May 1, 2020

Copy link
Copy Markdown
Author

Are you root?

@TheMayhem6328

TheMayhem6328 commented May 1, 2020

Copy link
Copy Markdown

I tried with sudo and even sudo -s but it didn't work
I tried on Ubuntu 20.04 but still it doesn't work

@alexjj

alexjj commented May 1, 2020

Copy link
Copy Markdown
Author

Switch to root first. sudo doesn't travel down pipes without tees or something.

sudo -i
zfs list -H -o name -t snapshot | xargs -n1 zfs destroy

@dr3mro

dr3mro commented Jun 12, 2020

Copy link
Copy Markdown

zfs list -H -o name -t snapshot | xargs -n1 sudo zfs destroy

works for me on 20.04

@TheMayhem6328

TheMayhem6328 commented Jun 12, 2020 via email

Copy link
Copy Markdown

@gcclinux

Copy link
Copy Markdown

Recommend to be aware that unless specified a dataset ALL snapshots gets deleted. here is a USER specific example on Ubuntu 20.04:

$ sudo zfs list -H -o name -t snapshot rpool/USERDATA/example | sudo xargs -n1 zfs destroy

@mas90

mas90 commented Oct 23, 2020

Copy link
Copy Markdown

You can also zfs destroy rpool@%.

foo%bar denotes a range of snapshots from foo to bar; omitting either uses the earliest or latest snapshot respectively.

@ergo3d

ergo3d commented Dec 14, 2020

Copy link
Copy Markdown

thanks! works after sudo su

@harry-stark

Copy link
Copy Markdown

So guys a little help here, I deleted all the snapshots cause they were taking up all the space, it worked fine for a while, but now Ubuntu will not boot up showing a sys error "Failed to MARK current zsys boot as successful".Any solutions

@alexjj

alexjj commented Dec 21, 2020

Copy link
Copy Markdown
Author

I suspect it's how ubuntu does things with zsys and you'd be better off asking on ubuntu forums.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment