Score:0

How to delete ZFS snapshots in bulk and upgrading to non LTS version?

mx flag

Two question.....

  1. I have installed Ubuntu LTS 20.04.3 with ZFS and encryption, few hours ago, but don't know how to delete snapshots as they are piling up pretty quickly, I'm setting up my installation, installed zfs-auto-snapshot package but it's not detecting the snapshots for some reason on

$sudo zfs-auto-snapshot --keep NUM

No matter what number I give it's says no snapshots detected or sth like that, also skimmed through ZFS manpage but there was only method of deleting snapshots one by one which is very tedious as I have already like 15/20 snapshots piled up....

So what's the method/solution I should use to tackle it??

  1. Though I moved to LTS version by now, I want the non LTS version, so is there anyway I can achieve that from LTS version to non LTS version a smooth shift without messing anything up?
Score:1
in flag

You can list ZFS snapshots in the terminal with the following command:

zfs list -t snapshot

To remove a specific snapshot, you can do this:

sudo zfs destroy rpool/USERDATA/MHT@FRIDAY09-03-21

If you would like to remove all snapshots — damn the torpedoes! — you can do this:

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

Be careful when issuing zfs destroy commands, because there is no undo.

As for your second question, the window to upgrade from 20.04 ⇢ 20.10 ⇢ 21.04 has closed, as 20.10 is no longer supported. The simplest way to get your machine up to 21.04 would be to reinstall the OS using the newer installation .iso.

Sajid Mahmood avatar
mx flag
I know, I can delete specific snapshots with these commands but I wanna delete all snapshots in one go or more than one as they pile up pretty quickly
in flag
I generally do not share the "damn the torpedoes" command to remove all ZFS snapshots, because this almost always results in people holding *me* accountable for their impatience later. However, there you go. **Note:** I offer no warranty with this answer.
tatsu avatar
ke flag
I get `no datasets available` on the first command. (yes, I am on a ZFS ubuntu)
Harlan Nelson avatar
in flag
I keep getting annot destroy snapshots: permission denied and the are about 100's of these to delete one at a time. After deleting about 50, the remaining space amount has not changed at all. There has to be a better way to get this done.
in flag
If you are receiving permission denied errors, then it usually means that there's a missing `sudo` in front of the command or you're trying to do things with a ZFS volume that was created elsewhere and not fully brought into the current system
Score:0
cn flag

You can avoid the error Error: The filesystem argument list is empty. by listing the filesystem you want to remove snapshots for. As an example:

zfs-auto-snapshot --destroy-only -k 1 --label=hourly rpool/USERDATA

This command won't remove any snapshots created manually or snapshots created by zsys.

To upgrade to the latest normal Ubuntu release, you can use the following:

sudo sed -i 's/^Prompt=.*/Prompt=normal/' /etc/update-manager/release-upgrades
sudo do-release-upgrade
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.