You are not logged in.

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

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

[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: 39

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: 14

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

#5 2023-01-20 08:34:54

Ownanierer
Member
Registered: 2022-12-30
Posts: 23

Re: [SOLVED] Unable to delete timeshift btrfs snapshot

Kobrakai wrote:

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.

I now have exactly the same problem and tried to reproduce your solution:

sudo btrfs subvolume list /

ID 256 gen 12037 top level 5 path timeshift-btrfs/snapshots/2023-01-14_20-47-58/@
ID 257 gen 12071 top level 5 path @home
ID 258 gen 12071 top level 5 path @log
ID 259 gen 12028 top level 5 path @pkg
ID 260 gen 11947 top level 5 path @.snapshots
ID 261 gen 17 top level 256 path timeshift-btrfs/snapshots/2023-01-14_20-47-58/@/var/lib/portables
ID 262 gen 18 top level 256 path timeshift-btrfs/snapshots/2023-01-14_20-47-58/@/var/lib/machines
ID 300 gen 11678 top level 5 path timeshift-btrfs/snapshots/2023-01-06_08-00-01/@
ID 314 gen 11678 top level 5 path timeshift-btrfs/snapshots/2023-01-13_09-00-01/@
ID 323 gen 12071 top level 5 path @
ID 327 gen 11678 top level 5 path timeshift-btrfs/snapshots/2023-01-15_12-30-05/@
ID 333 gen 11678 top level 5 path timeshift-btrfs/snapshots/2023-01-17_22-53-10/@
ID 336 gen 11678 top level 5 path timeshift-btrfs/snapshots/2023-01-18_11-30-18/@
ID 337 gen 11678 top level 5 path timeshift-btrfs/snapshots/2023-01-18_14-53-50/@
ID 338 gen 11678 top level 5 path timeshift-btrfs/snapshots/2023-01-19_19-58-27/@
ID 339 gen 11966 top level 5 path timeshift-btrfs/snapshots/2023-01-20_08-00-01/@
ID 340 gen 11971 top level 5 path timeshift-btrfs/snapshots/2023-01-20_08-04-46/@

It is these two/three:
ID 261 gen 17 top level 256 path timeshift-btrfs/snapshots/2023-01-14_20-47-58/@/var/lib/portables
ID 262 gen 18 top level 256 path timeshift-btrfs/snapshots/2023-01-14_20-47-58/@/var/lib/machines
ID 300 gen 11678 top level 5 path timeshift-btrfs/snapshots/2023-01-06_08-00-01/@

When running:

sudo btrfs subvolume delete /run/timeshift/backup/timeshift-btrfs/snapshots/2023-01-14_20-47-58/@/var/lib/portables

ERROR: Could not statfs: No such file or directory

I do not understand that because I checked and the volume is definetly on this path.

Offline

#6 2023-01-20 09:17:00

Ownanierer
Member
Registered: 2022-12-30
Posts: 23

Re: [SOLVED] Unable to delete timeshift btrfs snapshot

Ownanierer wrote:

When running:

sudo btrfs subvolume delete /run/timeshift/backup/timeshift-btrfs/snapshots/2023-01-14_20-47-58/@/var/lib/portables

ERROR: Could not statfs: No such file or directory

I do not understand that because I checked and the volume is definetly on this path.

Ok, so I found the issue. Apparently timeshift only creates the path under /run, when it is running (duh). It also create a folder between  /run/timeshift and /run/timeshift/backup so the correct path looks like this: /run/timeshift/[4-digit numer]/backup/timeshift-btrfs/snapshots/2023-01-14_20-47-58/@
I oversaw this folder when checking the path. When I specify it, everything works as described above.

Last edited by Ownanierer (2023-01-20 09:28:27)

Offline

#7 2024-03-10 23:34:45

GustavoLeonhart
Member
Registered: 2024-03-10
Posts: 2

Re: [SOLVED] Unable to delete timeshift btrfs snapshot

Ownanierer wrote:
Ownanierer wrote:

When running:

sudo btrfs subvolume delete /run/timeshift/backup/timeshift-btrfs/snapshots/2023-01-14_20-47-58/@/var/lib/portables

ERROR: Could not statfs: No such file or directory

I do not understand that because I checked and the volume is definetly on this path.

Ok, so I found the issue. Apparently timeshift only creates the path under /run, when it is running (duh). It also create a folder between  /run/timeshift and /run/timeshift/backup so the correct path looks like this: /run/timeshift/[4-digit numer]/backup/timeshift-btrfs/snapshots/2023-01-14_20-47-58/@
I oversaw this folder when checking the path. When I specify it, everything works as described above.

Thank you very much for sharing the info Ownanierer and everyone, finnaly i was able to fix my timeshift too.

Offline

#8 2024-03-10 23:36:19

2ManyDogs
Forum Fellow
Registered: 2012-01-15
Posts: 4,645

Re: [SOLVED] Unable to delete timeshift btrfs snapshot

Closing this old solved thread.


How to post. A sincere effort to use modest and proper language and grammar is a sign of respect toward the community.

Offline

Board footer

Powered by FluxBB