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

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?
1

2 Answers

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.

2

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 

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like