Awhile ago I had to revert to a pprevious setup due to a problematic upgrade. The recovery went well, but the process left the previous @ subvolume (which I renamed @_new) as a lingering subvolume in a group which includes @, @home, and a swap file. I've tried to delete @_new, both using the command line as well as Oshluvr's script for Dolphin, but no luck. I'm notified that the subvolume has been deleted, but it hasn't bee, I suspect this might be a problem of heirarchy, but since I am by and large ignorant of the structure of btrfs, I have no idea what to do. Any help would be appreciated.
Announcement
Collapse
No announcement yet.
Subvolume won't delete
Collapse
X
-
The only time I've had trouble deleting a subvolume was when another subvolume was nested within it.
So you're saying that when using the command line, you get no response from the command line - no errors or messages - but the subvolume remains?
Does it still have content or is it empty?
- Top
- Bottom
-
Assuming this subvolume is under /, enter this in Konsole and post what it returns:
Code:sudo btrfs su li /
- Top
- Bottom
Comment
-
-
Here's the listing, plus the results of the delete command by terminal:
steve@steve-b460mds3hv2:~$ sudo btrfs su li /
[sudo] password for steve:
ID 256 gen 296249 top level 5 path @_new
ID 258 gen 296205 top level 5 path @swap
ID 259 gen 70 top level 256 path @_new/var/lib/portables
ID 260 gen 70 top level 256 path @_new/var/lib/machines
ID 263 gen 296254 top level 5 path @home
ID 429 gen 296254 top level 5 path @
ID 438 gen 291953 top level 5 path snapshots/@_260712-194929_ro
ID 439 gen 291955 top level 5 path snapshots/@home_260712-195022_ro
ID 440 gen 295884 top level 5 path snapshots/@_260719-194320_ro
ID 441 gen 295887 top level 5 path snapshots/@home_260719-194439_ro
steve@steve-b460mds3hv2:~$ sudo btrfs subv delete /mnt/@_new
Delete subvolume 256 (no-commit): '/mnt/@_new'
ERROR: Could not destroy subvolume/snapshot: Directory not empty
- Top
- Bottom
Comment
-
Originally posted by oldgeek View PostERROR: Could not destroy subvolume/snapshot: Directory not empty
This error occurs because Btrfs does not allow you to delete a parent subvolume if it contains nested, hidden subvolumes inside it. Even if ls shows the directory is empty, systemd components (like machines or portables) or Docker/Podman layers often automatically create subvolumes within your snapshots, blocking the deletion.
To resolve this issue, you must identify and delete the nested subvolumes first.
Step 1: Find the Hidden Nested Subvolumes
Run the following command to reveal any hidden nested subvolumes under your target directory:
sudo btrfs subvolume list -o /path/to/your/target/subvolume
Use code with caution.
(Note: Replace /path/to/your/target/subvolume with the exact path of the subvolume you are trying to delete.)
Step 2: Delete the Inner Subvolumes
The step above will spit out a list of nested paths. Delete each of those inner subvolumes individually, starting from the deepest level:
sudo btrfs subvolume delete /path/to/your/target/subvolume/nested/path
Use code with caution.
Step 3: Delete the Parent Subvolume
Once all the inner subvolumes are cleared out, you can successfully delete your main subvolume without errors:
sudo btrfs subvolume delete /path/to/your/target/subvolume
Windows no longer obstruct my view.
Using Kubuntu Linux since March 23, 2007.
"It is a capital mistake to theorize before one has data." - Sherlock Holmes
- Top
- Bottom
Comment
-
Well, there you go. You have two nested subvolumes under "@_new":Originally posted by oldgeek View PostHere's the listing, plus the results of the delete command by terminal:
steve@steve-b460mds3hv2:~$ sudo btrfs su li /
[sudo] password for steve:
ID 256 gen 296249 top level 5 path @_new
ID 258 gen 296205 top level 5 path @swap
ID 259 gen 70 top level 256 path @_new/var/lib/portables
ID 260 gen 70 top level 256 path @_new/var/lib/machines
ID 263 gen 296254 top level 5 path @home
ID 429 gen 296254 top level 5 path @
ID 438 gen 291953 top level 5 path snapshots/@_260712-194929_ro
ID 439 gen 291955 top level 5 path snapshots/@home_260712-195022_ro
ID 440 gen 295884 top level 5 path snapshots/@_260719-194320_ro
ID 441 gen 295887 top level 5 path snapshots/@home_260719-194439_ro
steve@steve-b460mds3hv2:~$ sudo btrfs subv delete /mnt/@_new
Delete subvolume 256 (no-commit): '/mnt/@_new'
ERROR: Could not destroy subvolume/snapshot: Directory not empty
Do this in Konsole:Code:ID 259 gen 70 top level 256 path @_new/var/lib/portables ID 260 gen 70 top level 256 path @_new/var/lib/machines
Code:sudo btrfs su de -c /mnt/@_new/var/lib/portables sudo btrfs su de -c /mnt/@_new/var/lib/machines sudo btrfs su de -c /mnt/@_new
- Top
- Bottom
Comment
-
I tried to delete both subvolumes, but got error messages:
steve@steve-b460mds3hv2:~$ sudo btrfs su de -c /mnt/@_new/var/lib/portables
ERROR: Could not statfs: No such file or directory
steve@steve-b460mds3hv2:~$ sudo btrfs su de -c /mnt/@_new/var/lib/machines
ERROR: Could not statfs: No such file or directory
- Top
- Bottom
Comment
-
UPDATE: Using oshunluvr's btrfs script for Dolphin, I was able to delete the two nested files as well as the @_new subvolume. I don't know why the terminal commands didn't work, though. Viewing the nested files on Dolphin, I saw a padlock icon on both. Can anyone clear up these two mysteries for me? And thanks to the gentleman who answered my question and led me to the correct solution.
- Top
- Bottom
Comment
-
You would see a "padlock" using Dolphin because they were owned by root user and not allowed to be viewed by other users.
I can't answer why the command line deletes didn't work except to speculate that the path was incorrect. Which might explain why the Dolphin service menu did work because it would sus the correct path.
For future reference, note that Read-Only subvolumes/snapshots are not delete-able until they are set as Read-Write. The Dolphin service menus can check and change that setting as well.
BTW, glad you're getting some use from my efforts re. the Dolphin menus
Last edited by oshunluvr; Yesterday, 07:33 PM.
- Top
- Bottom
Comment
-
I don't get that.Originally posted by oshunluvr View PostFor future reference, note that Read-Only subvolumes/snapshots are not delete-able until they are set as Read-Write.
I just deleted a read-only snapshot.Code:$ sudo btrfs subvolume create @foo Create subvolume './@foo' $ sudo btrfs subvolume snapshot -r @foo @bar Create readonly snapshot of '@foo' in '@bar' $ sudo btrfs subvolume delete @bar Delete subvolume 570 (no-commit): '/t/@bar'
Regards, John Little
- Top
- Bottom
Comment
Users Viewing This Topic
Collapse
There are 0 users viewing this topic.








Comment