Cannot delete old snapshot

I cannot delete a snapshot. How do I delete it?

Check with cli (as root):

snapper ls
snapper delete #number

And have your tried using the command-line delete command?

Here’s a snippet from the URL I have provided below.
… quote

7.6.4 Deleting Snapshots

To delete a snapshot with the YaST Snapper module, choose a snapshot from the list and click Delete.

To delete a snapshot with the command-line tool, you need to know its number. Get it by running
snapper list.

To delete a snapshot, run
snapper delete NUMBER.

Deleting the current default subvolume snapshot is not allowed.

When deleting snapshots with Snapper, the freed space will be claimed by a Btrfs process running in the background. Thus the visibility and the availability of free space is delayed. In case you need space freed by deleting a snapshot to be available immediately, use the option –sync with the delete command.

Samples:

snapper delete 65
Deletes snapshot 65 for the default (root) configuration.

snapper -c home delete 89 90
Deletes snapshots 89 and 90 for a custom configuration named home.

snapper delete --sync 23
Deletes snapshot 23 for the default (root) configuration and makes the freed space available immediately.

Read this section:

Assuming you are trying to delete snapshot 387 - it is your current root snapshot.

2 Likes

Hello,
I have the same issue, for some reason snapshot 62 cannot be deleted, however I was able to remove snapshots 63-90.

# snapper list
   # | Type   | Pre # | Date                             | User | Used Space | Cleanup | Description             | Userdata     
-----+--------+-------+----------------------------------+------+------------+---------+-------------------------+--------------
  0  | single |       |                                  | root |            |         | current                 |              
 62  | single |       | Fri 05 May 2023 01:42:32 AM CEST | root |   1.10 GiB | number  | Snapshot Update of #61  | important=yes
 91  | single |       | Sun 11 Jun 2023 12:16:52 AM CEST | root | 115.14 MiB | number  | Snapshot Update of #90  | important=yes
 92  | single |       | Mon 12 Jun 2023 12:45:51 AM CEST | root |  63.48 MiB | number  | Snapshot Update of #91  | important=yes
 93  | single |       | Wed 14 Jun 2023 12:49:37 AM CEST | root |  93.15 MiB | number  | Snapshot Update of #92  | important=yes
 94  | single |       | Thu 15 Jun 2023 01:42:01 AM CEST | root | 205.86 MiB | number  | Snapshot Update of #93  | important=yes
 95  | single |       | Sat 17 Jun 2023 12:18:23 AM CEST | root | 173.04 MiB | number  | Snapshot Update of #94  | important=yes
 96  | single |       | Sun 18 Jun 2023 01:04:13 AM CEST | root |  67.96 MiB | number  | Snapshot Update of #95  | important=yes
 97  | single |       | Tue 20 Jun 2023 01:38:08 AM CEST | root |  79.30 MiB | number  | Snapshot Update of #96  | important=yes
 98  | single |       | Wed 21 Jun 2023 01:37:39 AM CEST | root |  95.74 MiB | number  | Snapshot Update of #97  | important=yes
 99  | single |       | Thu 22 Jun 2023 12:14:43 AM CEST | root |  68.48 MiB | number  | Snapshot Update of #98  | important=yes
100  | single |       | Fri 23 Jun 2023 01:35:30 AM CEST | root |  90.18 MiB | number  | Snapshot Update of #99  | important=yes
101  | single |       | Sat 24 Jun 2023 12:16:45 AM CEST | root |  90.17 MiB | number  | Snapshot Update of #100 | important=yes
102  | single |       | Sun 25 Jun 2023 12:36:14 AM CEST | root |  99.01 MiB | number  | Snapshot Update of #101 | important=yes
103  | single |       | Mon 26 Jun 2023 12:51:22 AM CEST | root |  52.78 MiB | number  | Snapshot Update of #102 | important=yes
104  | single |       | Tue 27 Jun 2023 01:24:12 AM CEST | root |  58.21 MiB | number  | Snapshot Update of #103 | important=yes
105  | single |       | Wed 28 Jun 2023 12:45:24 AM CEST | root |  58.21 MiB | number  | Snapshot Update of #104 | important=yes
106  | single |       | Thu 29 Jun 2023 01:11:26 AM CEST | root |  92.40 MiB | number  | Snapshot Update of #105 | important=yes
107  | single |       | Fri 30 Jun 2023 01:35:27 AM CEST | root |  71.29 MiB | number  | Snapshot Update of #106 | important=yes
108  | single |       | Sat 01 Jul 2023 01:56:45 AM CEST | root |  95.39 MiB | number  | Snapshot Update of #107 | important=yes
109  | single |       | Tue 04 Jul 2023 01:45:40 AM CEST | root |  87.02 MiB | number  | Snapshot Update of #108 | important=yes
110  | single |       | Wed 05 Jul 2023 12:20:37 AM CEST | root |  87.05 MiB | number  | Snapshot Update of #109 | important=yes
111  | single |       | Fri 07 Jul 2023 12:50:54 AM CEST | root |  65.33 MiB | number  | Snapshot Update of #110 | important=yes
112  | single |       | Sat 08 Jul 2023 12:41:44 AM CEST | root |  50.43 MiB | number  | Snapshot Update of #111 | important=yes
113  | single |       | Sun 09 Jul 2023 12:49:31 AM CEST | root |  61.52 MiB | number  | Snapshot Update of #112 | important=yes
114  | single |       | Mon 10 Jul 2023 12:04:04 AM CEST | root |  63.74 MiB | number  | Snapshot Update of #113 | important=yes
115  | single |       | Tue 11 Jul 2023 01:23:13 AM CEST | root |  52.82 MiB | number  | Snapshot Update of #114 | important=yes
116  | single |       | Wed 12 Jul 2023 01:24:01 AM CEST | root |  62.85 MiB | number  | Snapshot Update of #115 | important=yes
117  | single |       | Fri 14 Jul 2023 01:35:05 AM CEST | root |  63.61 MiB | number  | Snapshot Update of #116 | important=yes
118  | single |       | Sat 15 Jul 2023 12:56:02 AM CEST | root |  63.11 MiB | number  | Snapshot Update of #117 | important=yes
119  | single |       | Sun 16 Jul 2023 12:12:42 AM CEST | root |  63.57 MiB | number  | Snapshot Update of #118 | important=yes
120  | single |       | Tue 18 Jul 2023 12:40:38 AM CEST | root |  64.20 MiB | number  | Snapshot Update of #119 | important=yes
121  | single |       | Wed 19 Jul 2023 12:26:17 AM CEST | root |  54.16 MiB | number  | Snapshot Update of #120 | important=yes
122  | single |       | Thu 20 Jul 2023 01:15:47 AM CEST | root |  67.05 MiB | number  | Snapshot Update of #121 | important=yes
123  | single |       | Wed 26 Jul 2023 01:22:19 AM CEST | root | 323.79 MiB | number  | Snapshot Update of #122 | important=yes
124  | single |       | Sun 30 Jul 2023 01:30:53 AM CEST | root | 100.80 MiB | number  | Snapshot Update of #123 | important=yes
125  | single |       | Mon 31 Jul 2023 01:43:32 AM CEST | root |  64.16 MiB | number  | Snapshot Update of #124 | important=yes
126  | single |       | Tue 01 Aug 2023 01:07:27 AM CEST | root |  64.05 MiB | number  | Snapshot Update of #125 | important=yes
127  | single |       | Wed 02 Aug 2023 01:08:00 AM CEST | root |  63.93 MiB | number  | Snapshot Update of #126 | important=yes
128  | single |       | Thu 03 Aug 2023 12:47:19 AM CEST | root |  64.81 MiB | number  | Snapshot Update of #127 | important=yes
129  | single |       | Fri 04 Aug 2023 01:18:48 AM CEST | root |  64.37 MiB | number  | Snapshot Update of #128 | important=yes
130  | single |       | Sat 05 Aug 2023 01:08:44 AM CEST | root |  94.40 MiB | number  | Snapshot Update of #129 | important=yes
131  | single |       | Sun 06 Aug 2023 01:13:44 AM CEST | root | 103.21 MiB | number  | Snapshot Update of #130 | important=yes
132  | single |       | Mon 07 Aug 2023 01:21:53 AM CEST | root |  65.65 MiB | number  | Snapshot Update of #131 | important=yes
133  | single |       | Tue 08 Aug 2023 12:50:46 AM CEST | root |  79.47 MiB | number  | Snapshot Update of #132 | important=yes
134  | single |       | Wed 09 Aug 2023 01:03:59 AM CEST | root |  55.95 MiB | number  | Snapshot Update of #133 | important=yes
135  | single |       | Thu 10 Aug 2023 01:48:12 AM CEST | root |  65.30 MiB |         | Snapshot Update of #134 | important=yes
136  | single |       | Fri 11 Aug 2023 12:50:10 AM CEST | root |  67.61 MiB | number  | Snapshot Update of #135 | important=yes
137  | single |       | Sat 12 Aug 2023 01:33:54 AM CEST | root |  65.14 MiB | number  | Snapshot Update of #136 | important=yes
138* | single |       | Sun 13 Aug 2023 01:14:34 AM CEST | root |  11.99 MiB |         | Snapshot Update of #137 |              
139  | single |       | Mon 14 Aug 2023 01:11:02 AM CEST | root |   1.27 GiB | number  | Snapshot Update of #138 |              
140  | single |       | Tue 15 Aug 2023 12:12:37 AM CEST | root |   1.27 GiB |         | Snapshot Update of #138 |              
141  | single |       | Tue 22 Aug 2023 02:56:57 PM CEST | root |  13.71 MiB |         | Snapshot Update of #138 |              
142  | single |       | Tue 22 Aug 2023 03:36:44 PM CEST | root |  13.71 MiB |         | Snapshot Update of #138 |              

If I try remove # snapper -v delete 62

Deleting snapshot from root:
62
Deleting snapshot failed.

I’m using a RAID1 setup:

btrfs fi usage /
Overall:
    Device size:                  20.00GiB
    Device allocated:             20.00GiB
    Device unallocated:            1.00MiB
    Device missing:                  0.00B
    Device slack:                    0.00B
    Used:                         14.50GiB
    Free (estimated):              4.59GiB      (min: 4.59GiB)
    Free (statfs, df):             4.59GiB
    Data ratio:                       1.00
    Metadata ratio:                   2.00
    Global reserve:               47.69MiB      (used: 0.00B)
    Multiple profiles:                  no

Data,single: Size:17.94GiB, Used:13.34GiB (74.39%)
   /dev/md0p2     17.94GiB

Metadata,DUP: Size:1.00GiB, Used:590.38MiB (57.65%)
   /dev/md0p2      2.00GiB

System,DUP: Size:32.00MiB, Used:16.00KiB (0.05%)
   /dev/md0p2     64.00MiB

Unallocated:
   /dev/md0p2      1.00MiB

In /var/log/snapper.log I see:

Btrfs.cc(deleteSnapshot):436 - delete snapshot failed, btrfs_util_delete_subvolume_fd()       failed, errno:39 (Directory not empty)

removing this empty dir did not help.

That appears to be your base snapshot. So no you can not remove it. If you did then the OD would stop working.

No, you do not have the same issue.

Show

btrfs subvolume list /

Hello @arvidjaar

# btrfs subvolume list /
ID 256 gen 29 top level 5 path @
ID 257 gen 9661 top level 256 path @/usr/local
ID 258 gen 9661 top level 256 path @/srv
ID 259 gen 9683 top level 256 path @/root
ID 260 gen 9661 top level 256 path @/opt
ID 261 gen 9661 top level 256 path @/home
ID 262 gen 9661 top level 256 path @/boot/writable
ID 263 gen 9661 top level 256 path @/boot/grub2/x86_64-efi
ID 264 gen 9661 top level 256 path @/boot/grub2/i386-pc
ID 265 gen 9677 top level 256 path @/.snapshots
ID 343 gen 5167 top level 265 path @/.snapshots/62/snapshot
ID 344 gen 9648 top level 343 path @/.snapshots/62/snapshot/var/lib/machines
ID 381 gen 5592 top level 265 path @/.snapshots/91/snapshot
ID 382 gen 5672 top level 265 path @/.snapshots/92/snapshot
ID 384 gen 5719 top level 265 path @/.snapshots/93/snapshot
ID 385 gen 5751 top level 265 path @/.snapshots/94/snapshot
ID 387 gen 6342 top level 265 path @/.snapshots/95/snapshot
ID 388 gen 6445 top level 265 path @/.snapshots/96/snapshot
ID 390 gen 6482 top level 265 path @/.snapshots/97/snapshot
ID 391 gen 6518 top level 265 path @/.snapshots/98/snapshot
ID 392 gen 6556 top level 265 path @/.snapshots/99/snapshot
ID 393 gen 6591 top level 265 path @/.snapshots/100/snapshot
ID 394 gen 6625 top level 265 path @/.snapshots/101/snapshot
ID 395 gen 6660 top level 265 path @/.snapshots/102/snapshot
ID 396 gen 6703 top level 265 path @/.snapshots/103/snapshot
ID 397 gen 6722 top level 265 path @/.snapshots/104/snapshot
ID 398 gen 6741 top level 265 path @/.snapshots/105/snapshot
ID 399 gen 6778 top level 265 path @/.snapshots/106/snapshot
ID 400 gen 6816 top level 265 path @/.snapshots/107/snapshot
ID 401 gen 6879 top level 265 path @/.snapshots/108/snapshot
ID 404 gen 6944 top level 265 path @/.snapshots/109/snapshot
ID 405 gen 6979 top level 265 path @/.snapshots/110/snapshot
ID 407 gen 7024 top level 265 path @/.snapshots/111/snapshot
ID 408 gen 7059 top level 265 path @/.snapshots/112/snapshot
ID 409 gen 7078 top level 265 path @/.snapshots/113/snapshot
ID 410 gen 7099 top level 265 path @/.snapshots/114/snapshot
ID 411 gen 7121 top level 265 path @/.snapshots/115/snapshot
ID 412 gen 7148 top level 265 path @/.snapshots/116/snapshot
ID 414 gen 7204 top level 265 path @/.snapshots/117/snapshot
ID 415 gen 7230 top level 265 path @/.snapshots/118/snapshot
ID 416 gen 7263 top level 265 path @/.snapshots/119/snapshot
ID 418 gen 7329 top level 265 path @/.snapshots/120/snapshot
ID 419 gen 7364 top level 265 path @/.snapshots/121/snapshot
ID 420 gen 7424 top level 265 path @/.snapshots/122/snapshot
ID 426 gen 7552 top level 265 path @/.snapshots/123/snapshot
ID 430 gen 7653 top level 265 path @/.snapshots/124/snapshot
ID 431 gen 7707 top level 265 path @/.snapshots/125/snapshot
ID 432 gen 7730 top level 265 path @/.snapshots/126/snapshot
ID 433 gen 7758 top level 265 path @/.snapshots/127/snapshot
ID 434 gen 7781 top level 265 path @/.snapshots/128/snapshot
ID 435 gen 7819 top level 265 path @/.snapshots/129/snapshot
ID 436 gen 7841 top level 265 path @/.snapshots/130/snapshot
ID 437 gen 7893 top level 265 path @/.snapshots/131/snapshot
ID 438 gen 7933 top level 265 path @/.snapshots/132/snapshot
ID 439 gen 7992 top level 265 path @/.snapshots/133/snapshot
ID 440 gen 8041 top level 265 path @/.snapshots/134/snapshot
ID 441 gen 8060 top level 265 path @/.snapshots/135/snapshot
ID 442 gen 8088 top level 265 path @/.snapshots/136/snapshot
ID 443 gen 8140 top level 265 path @/.snapshots/137/snapshot
ID 444 gen 9653 top level 265 path @/.snapshots/138/snapshot
ID 445 gen 8803 top level 265 path @/.snapshots/139/snapshot
ID 446 gen 9482 top level 265 path @/.snapshots/140/snapshot
ID 447 gen 9555 top level 265 path @/.snapshots/141/snapshot
ID 448 gen 9590 top level 265 path @/.snapshots/142/snapshot
ID 449 gen 9657 top level 265 path @/.snapshots/143/snapshot

I thought 0 was the base snapshot.

Snapshot 62 has nested subvolume which must be deleted first.

tumbleweed:/home/andrei/btrfs # btrfs subvolume create top
Create subvolume './top'
tumbleweed:/home/andrei/btrfs # btrfs subvolume create top/bottom
Create subvolume 'top/bottom'
tumbleweed:/home/andrei/btrfs # btrfs subvolume delete top
Delete subvolume (no-commit): '/home/andrei/btrfs/top'
ERROR: Could not destroy subvolume/snapshot: Directory not empty
tumbleweed:/home/andrei/btrfs #

current one.

Also you seem to have only 20 gig available on the partition this does not work with snapshots you need at least 40 gig

20GB should be fine no?
https://en.opensuse.org/openSUSE:Snapper_Tutorial#Snapper_Default_Aspects_for_Disks_>_16_GB_and_<_16_GB

I used default settings during installation, do you advice adjusting this during install?

any idea where this nested subvolume comes from?
This devices has been running as headless VM host for as long as i can remember until I ran out of disk space.

trying to remove throws error:

btrfs subvolume delete 62/snapshot/var/lib/machines/
Delete subvolume (no-commit): '/.snapshots/62/snapshot/var/lib/machines'
ERROR: Could not destroy subvolume/snapshot: Read-only file system

No

btrfs property set 62/snapshot ro false

It is up to you to verify that /.snapshots/62/snapshot/var/lib/machines is not used and does not contain any needed data.

Amazing, thanks.
set snapshot ro false
btrfs property set 62/snapshot ro false
removed nested subvolme
btrfs subvolume delete 62/snapshot/var/lib/machines/
tested to see if I could remove snapshot 62
btrfs subvolume delete /.snapshots/62/snapshot
Then started snapper-cleanup.service
systemctl start snapper-cleanup.service
Now all snapshots are cleaned:

btrfs subvolume list /
ID 256 gen 29 top level 5 path @
ID 257 gen 9661 top level 256 path @/usr/local
ID 258 gen 9661 top level 256 path @/srv
ID 259 gen 9695 top level 256 path @/root
ID 260 gen 9661 top level 256 path @/opt
ID 261 gen 9661 top level 256 path @/home
ID 262 gen 9661 top level 256 path @/boot/writable
ID 263 gen 9661 top level 256 path @/boot/grub2/x86_64-efi
ID 264 gen 9661 top level 256 path @/boot/grub2/i386-pc
ID 265 gen 9693 top level 256 path @/.snapshots
ID 433 gen 7758 top level 265 path @/.snapshots/127/snapshot
ID 434 gen 7781 top level 265 path @/.snapshots/128/snapshot
ID 435 gen 7819 top level 265 path @/.snapshots/129/snapshot
ID 436 gen 7841 top level 265 path @/.snapshots/130/snapshot
ID 437 gen 7893 top level 265 path @/.snapshots/131/snapshot
ID 438 gen 7933 top level 265 path @/.snapshots/132/snapshot
ID 439 gen 7992 top level 265 path @/.snapshots/133/snapshot
ID 440 gen 8041 top level 265 path @/.snapshots/134/snapshot
ID 441 gen 8060 top level 265 path @/.snapshots/135/snapshot
ID 442 gen 8088 top level 265 path @/.snapshots/136/snapshot
ID 443 gen 8140 top level 265 path @/.snapshots/137/snapshot
ID 444 gen 9653 top level 265 path @/.snapshots/138/snapshot
ID 445 gen 8803 top level 265 path @/.snapshots/139/snapshot
ID 446 gen 9482 top level 265 path @/.snapshots/140/snapshot
ID 447 gen 9555 top level 265 path @/.snapshots/141/snapshot
ID 448 gen 9590 top level 265 path @/.snapshots/142/snapshot
ID 449 gen 9657 top level 265 path @/.snapshots/143/snapshot

Don’t believe everything you read - what happens in the real world vs a controlled environment are different.

First off, I would never allow that many Snapshots to pile up. If your system is dup’ped at every update, and after 2-3 weeks the system boots and run fine, there’s no reason to keep Snapshots from two months ago.

I have 2 desktop systems (and 2 laptops) … one has a 30gb / and the second uses a 40gb /.

The one with 30gb / makes me nervous, because it shows about 8gb of available space. And for BTRFS, that’s on the verge of too little space with a massive update.

I wouldn’t even consider dedicating 20gb for / on a BTRFS system - that’s based on my personal real world usage. Admittedly, no one should consider just my experience.

Clean up all those Snapshots not required - maybe cleanup the journalctl logs, double check with any apps and libraries never used … should help to regain some space.

Final question, snapshots 139-140 seemed to have broken my VMs, or when the system boots into these snapshots, the VM does not start.

Would it be safe to remove 139-143?

$ snapper ls
   # | Type   | Pre # | Date                             | User | Used Space | Cleanup | Description             | Userdata     
-----+--------+-------+----------------------------------+------+------------+---------+-------------------------+--------------
  0  | single |       |                                  | root |            |         | current                 |              
127  | single |       | Wed 02 Aug 2023 01:08:00 AM CEST | root |  65.34 MiB | number  | Snapshot Update of #126 | important=yes
128  | single |       | Thu 03 Aug 2023 12:47:19 AM CEST | root |  64.81 MiB | number  | Snapshot Update of #127 | important=yes
129  | single |       | Fri 04 Aug 2023 01:18:48 AM CEST | root |  64.37 MiB | number  | Snapshot Update of #128 | important=yes
130  | single |       | Sat 05 Aug 2023 01:08:44 AM CEST | root |  94.40 MiB | number  | Snapshot Update of #129 | important=yes
131  | single |       | Sun 06 Aug 2023 01:13:44 AM CEST | root | 103.21 MiB | number  | Snapshot Update of #130 | important=yes
132  | single |       | Mon 07 Aug 2023 01:21:53 AM CEST | root |  65.65 MiB | number  | Snapshot Update of #131 | important=yes
133  | single |       | Tue 08 Aug 2023 12:50:46 AM CEST | root |  79.47 MiB | number  | Snapshot Update of #132 | important=yes
134  | single |       | Wed 09 Aug 2023 01:03:59 AM CEST | root |  55.95 MiB | number  | Snapshot Update of #133 | important=yes
135  | single |       | Thu 10 Aug 2023 01:48:12 AM CEST | root |  65.30 MiB |         | Snapshot Update of #134 | important=yes
136  | single |       | Fri 11 Aug 2023 12:50:10 AM CEST | root |  67.61 MiB | number  | Snapshot Update of #135 | important=yes
137  | single |       | Sat 12 Aug 2023 01:33:54 AM CEST | root |  65.14 MiB | number  | Snapshot Update of #136 | important=yes
138* | single |       | Sun 13 Aug 2023 01:14:34 AM CEST | root |  11.99 MiB |         | Snapshot Update of #137 |              
139  | single |       | Mon 14 Aug 2023 01:11:02 AM CEST | root |   1.27 GiB | number  | Snapshot Update of #138 |              
140  | single |       | Tue 15 Aug 2023 12:12:37 AM CEST | root |   1.27 GiB |         | Snapshot Update of #138 |              
141  | single |       | Tue 22 Aug 2023 02:56:57 PM CEST | root |  13.71 MiB |         | Snapshot Update of #138 |              
142  | single |       | Tue 22 Aug 2023 03:36:44 PM CEST | root |  13.71 MiB |         | Snapshot Update of #138 |              
143  | single |       | Thu 24 Aug 2023 12:29:25 PM CEST | root |  13.84 MiB |         | Snapshot Update of #138 | 

Ok, thanks very much for feedback.
I agree. With what I just experienced, I will try to expand (still possible?) or rebuild server with more space for /.
setup is RAID1 on two 256GB nvme-ssds.
I have a 3rd ssd (500GB) doing nothing, so will try write /var/logs to this device.