The easiest way to do this is to use the built in apt-btrfs-snapshot
commands:
Unlike normal snapshot deletion, you do not need to mount the filesystem to delete snapshots.
First, list the available apt-btrfs-snapshot
snapshots using the following command:
sudo apt-btrfs-snapshot list
Here is an example of the output from that command:
@apt-snapshot-old-root-2015-10-19_20:20:10
@apt-snapshot-2015-10-28_19:00:46
@apt-snapshot-2015-10-28_19:09:14
@apt-snapshot-2015-10-29_04:40:07
@apt-snapshot-2015-10-29_06:35:57
@apt-snapshot-2015-10-29_07:03:39
@apt-snapshot-2015-10-30_03:49:05
@apt-snapshot-2015-10-30_17:53:59
To delete the snapshot @apt-snapshot-2015-10-30_17:53:59
, run:
sudo apt-btrfs-snapshot delete @apt-snapshot-2015-10-30_17:53:59
You can also delete a number of snapshots by date. Here is an example of a command that would delete all snapshots that are older than 0 days.
sudo apt-btrfs-snapshot delete-older-than 0d
Here is an example of the output from that command:
Delete subvolume (no-commit): '/tmp/apt-btrfs-snapshot-mp-odfe0o4g/@apt-snapshot-old-root-2015-10-19_20:20:10'
ERROR: cannot delete '/tmp/apt-btrfs-snapshot-mp-odfe0o4g/@apt-snapshot-old-root-2015-10-19_20:20:10' - Directory not empty
Delete subvolume (no-commit): '/tmp/apt-btrfs-snapshot-mp-b2zv18qr/@apt-snapshot-2015-10-28_19:00:46'
Delete subvolume (no-commit): '/tmp/apt-btrfs-snapshot-mp-zjglvefe/@apt-snapshot-2015-10-28_19:09:14'
Delete subvolume (no-commit): '/tmp/apt-btrfs-snapshot-mp-lj3v74qa/@apt-snapshot-2015-10-29_04:40:07'
Delete subvolume (no-commit): '/tmp/apt-btrfs-snapshot-mp-vztc82zr/@apt-snapshot-2015-10-29_06:35:57'
Delete subvolume (no-commit): '/tmp/apt-btrfs-snapshot-mp-q0ou8e24/@apt-snapshot-2015-10-29_07:03:39'
Delete subvolume (no-commit): '/tmp/apt-btrfs-snapshot-mp-dw8eq0vv/@apt-snapshot-2015-10-30_03:49:05'
Delete subvolume (no-commit): '/tmp/apt-btrfs-snapshot-mp-vgo2yuf2/@apt-snapshot-2015-10-30_17:53:59'
As you can see, the available snapshots were deleted. However, the oldest snapshot "old-root" was not deleted and can still be used to roll back even though it is much older than 0 days.
Run the following command for a full list of features:
apt-btrfs-snapshot --help