You are not logged in.

#1 2021-06-06 17:30:06

Kobrakai
Member
Registered: 2021-05-22
Posts: 11

[SOLVED] Unable to delete timeshift btrfs snapshot

Hi,

I had to restore a snapshot the other day and Timeshift created a new one automatically as part of the restore. I would like to remove this snapshot but it's not letting me. These are the snapshots I have:

sudo timeshift --list

/dev/nvme0n1p2 is mounted at: /run/timeshift/backup, options: rw,relatime,ssd,space_cache,subvolid=5,subvol=/

Device : /dev/nvme0n1p2
UUID   : 6d64964a-26fb-413c-9c27-da081d053773
Path   : /run/timeshift/backup
Mode   : BTRFS
Status : OK
9 snapshots, 413.1 GB free

Num     Name                 Tags  Description
------------------------------------------------------------------------------
0    >  2021-06-02_11-00-01  D
1    >  2021-06-03_11-00-01  D
2    >  2021-06-04_11-00-01  D
3    >  2021-06-04_20-35-13  O     Before restoring '2021-06-04 17:13:27'
4    >  2021-06-05_10-20-38  D
5    >  2021-06-05_17-20-05  O     {timeshift-autosnap} {created before upgrade}
6    >  2021-06-05_23-22-31  O     {timeshift-autosnap} {created before upgrade}
7    >  2021-06-06_10-12-31  B D
8    >  2021-06-06_11-59-54  O     {timeshift-autosnap} {created before upgrade}

I want to delete the one labelled 'before restoring' so I try to delete it and this is what I get:

sudo timeshift --delete --snapshot '2021-06-04_20-35-13'                                                          1

/dev/nvme0n1p2 is mounted at: /run/timeshift/backup, options: rw,relatime,ssd,space_cache,subvolid=5,subvol=/

------------------------------------------------------------------------------
Removing snapshot: 2021-06-04_20-35-13
Deleting subvolume: @ (Id:256)
E: ERROR: Could not destroy subvolume/snapshot: Directory not empty

E: Failed to delete snapshot subvolume: '/run/timeshift/backup/timeshift-btrfs/snapshots/2021-06-04_20-35-13/@'
E: Failed to remove snapshot: 2021-06-04_20-35-13
------------------------------------------------------------------------------

From searching around I've seen a few people with this problem and it seems to have something to do with the sub volumes. These are the sub-volumes that I have:

sudo btrfs subvolume list /

ID 256 gen 13633 top level 5 path timeshift-btrfs/snapshots/2021-06-04_20-35-13/@
ID 257 gen 14336 top level 5 path @home
ID 261 gen 18 top level 256 path timeshift-btrfs/snapshots/2021-06-04_20-35-13/@/var/lib/portables
ID 262 gen 19 top level 256 path timeshift-btrfs/snapshots/2021-06-04_20-35-13/@/var/lib/machines
ID 333 gen 13633 top level 5 path timeshift-btrfs/snapshots/2021-06-02_11-00-01/@
ID 341 gen 13633 top level 5 path timeshift-btrfs/snapshots/2021-06-03_11-00-01/@
ID 345 gen 13633 top level 5 path timeshift-btrfs/snapshots/2021-06-04_11-00-01/@
ID 347 gen 14336 top level 5 path @
ID 354 gen 13633 top level 5 path timeshift-btrfs/snapshots/2021-06-05_10-20-38/@
ID 355 gen 13634 top level 5 path timeshift-btrfs/snapshots/2021-06-05_17-20-05/@
ID 362 gen 13634 top level 5 path timeshift-btrfs/snapshots/2021-06-05_23-22-31/@
ID 364 gen 13634 top level 5 path timeshift-btrfs/snapshots/2021-06-06_10-12-31/@
ID 377 gen 13634 top level 5 path timeshift-btrfs/snapshots/2021-06-06_11-59-54/@

For some reason it's created three sub-volumes for this snapshot with ID 256, 261, and 262. I'm not sure what the portables and machines ones are for?

There's a long discussion about this on github but people are saying it's to do with docker which I don't use, and it didn't seem to reach a conclusion:
https://github.com/teejee2008/timeshift/issues/141

I haven't tried deleting the sub-volumes directly because I didn't want to risk messing anything up.

Last edited by Kobrakai (2021-06-10 22:48:41)

Offline

#2 2021-06-10 19:08:38

Mr Victory
Member
Registered: 2021-06-10
Posts: 4

Re: [SOLVED] Unable to delete timeshift btrfs snapshot

Hello, you should delete these 2 subvolumes manually:
ID 261 gen 18 top level 256 path timeshift-btrfs/snapshots/2021-06-04_20-35-13/@/var/lib/portables
ID 262 gen 19 top level 256 path timeshift-btrfs/snapshots/2021-06-04_20-35-13/@/var/lib/machines
I do not know what these subvolumes contain but as they are backups, not the actual system, it should be safe to delete them.

Offline

#3 2021-06-10 19:17:22

Kobrakai
Member
Registered: 2021-05-22
Posts: 11

Re: [SOLVED] Unable to delete timeshift btrfs snapshot

I just fixed it with:

sudo btrfs subvolume delete /run/timeshift/backup/timeshift-btrfs/snapshots/2021-06-04_20-35-13/@/var/lib/portables
sudo btrfs subvolume delete /run/timeshift/backup/timeshift-btrfs/snapshots/2021-06-04_20-35-13/@/var/lib/machines
sudo btrfs subvolume delete /run/timeshift/backup/timeshift-btrfs/snapshots/2021-06-04_20-35-13/@

Then I was able to delete the snapshot through Timeshift as normal.

I'm curious why it created these two nested sub-volumes though? It seems to be reproducable when I tried it in a virtual machine.

Last edited by Kobrakai (2021-06-10 20:03:00)

Offline

#4 2021-06-10 21:02:10

goeb
Member
Registered: 2015-06-03
Posts: 11

Re: [SOLVED] Unable to delete timeshift btrfs snapshot

systemd, in its glorious wisdom, creates these subvolumes when /var (or rather /var/lib I guess) is on Btrfs. One way to prevent that crap is to remove them and create regular directories instead.

Also, AFAIK, you should be able to rm -rf subvolumes (including nested ones) nowadays, in case you want to bypass Timeshift.

Offline

Board footer

Powered by FluxBB