You are not logged in.

#1 2017-06-08 08:46:54

Yashalta
Member
Registered: 2017-05-28
Posts: 49

(RESOLVED) Why i cannot delete the subvolume of BTRFS?

Hi,
I'm a beginner in the btrfs but I've done this many times, and it happens sometimes, and I can not understand why?!?!

First I am booting frome "USBArchlinux" after i take a snapshot of subvolume of root using the command in the terminal:

# btrfs subvolume snapshot  /mnt/root /mnt/root_`date +%F-%R` 

and if something went wrong I do roll back.
When i do replace the subvolume of root i do rename it is like root_bad.
After i am login to the system and i do the following steps

$ su
Password: 
# mount /dev/sda /mnt
# cd /mnt
]# ls
home  i3  Only_YADRO  root  root_bad
# btrfs subvolume delete root_bad
Delete subvolume (no-commit): '/mnt/root_bad'
ERROR: cannot delete '/mnt/root_bad': Directory not empty
# 

And usually everything is removed, but sometimes i have like now i have "ERROR: cannot delete '/mnt/root_bad': Directory not empty"

question:
Why is this happening?
How to remove subvolume root_bad?

Last edited by Yashalta (2017-06-08 12:22:09)

Offline

#2 2017-06-08 09:13:46

Ropid
Member
Registered: 2015-03-09
Posts: 1,069

Re: (RESOLVED) Why i cannot delete the subvolume of BTRFS?

This google search result here seems like it might be what's happening for you:

https://superuser.com/questions/633219/ … -not-empty

You'd look at "btrfs su l /mnt" for the inner subvolumes.

Offline

#3 2017-06-08 09:15:27

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 13,723
Website

Re: (RESOLVED) Why i cannot delete the subvolume of BTRFS?

'btrfs subvol delete' is not recursive. If root_bad has subvolumes in it, you have to delete those first. 'btrfs subvol list root_bad' should tell you if there are any nested subvolumes.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#4 2017-06-08 10:55:51

Yashalta
Member
Registered: 2017-05-28
Posts: 49

Re: (RESOLVED) Why i cannot delete the subvolume of BTRFS?

Thanks for answers!
Is it possible find out by some of a command in terminal, what is inside list of root_bad "I did make" subvolume?

$ su
Password: 
# mount /dev/sda /mnt
# cd /mnt
# ls
home  i3  Only_YADRO  root  root_bad
# cd root_bad
[root@PC root_bad]# ls -al
total 32
drwxr-xr-x 1 root root  122 Jun  6 15:27 .
drwxr-xr-x 1 root root   56 Jun  7 16:14 ..
lrwxrwxrwx 1 root root    7 Mar 26 21:57 bin -> usr/bin
drwxr-xr-x 1 root root  128 Jun  6 15:49 boot
drwxr-xr-x 1 root root    0 Jun  6 15:21 dev
drwxr-xr-x 1 root root 2120 Jun  7 13:42 etc
drwxr-xr-x 1 root root    0 Jun  6 15:12 home
lrwxrwxrwx 1 root root    7 Mar 26 21:57 lib -> usr/lib
lrwxrwxrwx 1 root root    7 Mar 26 21:57 lib64 -> usr/lib
drwxr-xr-x 1 root root    0 Mar 26 21:57 mnt
drwxr-xr-x 1 root root    0 Mar 26 21:57 opt
dr-xr-xr-x 1 root root    0 Jun  6 15:21 proc
drwxr-x--- 1 root root   98 Jun  7 13:25 root
drwxr-xr-x 1 root root    0 Jun  6 15:21 run
lrwxrwxrwx 1 root root    7 Mar 26 21:57 sbin -> usr/bin
drwxr-xr-x 1 root root   14 Mar 26 21:57 srv
dr-xr-xr-x 1 root root    0 Jun  6 15:21 sys
drwxrwxrwt 1 root root    0 Jun  6 15:21 tmp
drwxr-xr-x 1 root root   80 Jun  7 13:30 usr
drwxr-xr-x 1 root root  116 Jun  6 15:58 var
[root@PC root_bad]#

after find out it i will easily delete the subvolume root bad

Offline

#5 2017-06-08 11:49:13

Ropid
Member
Registered: 2015-03-09
Posts: 1,069

Re: (RESOLVED) Why i cannot delete the subvolume of BTRFS?

You need to look through the output of this:

btrfs subvolume list /mnt

or shorter:

btrfs su l /mnt

Offline

#6 2017-06-08 12:21:10

Yashalta
Member
Registered: 2017-05-28
Posts: 49

Re: (RESOLVED) Why i cannot delete the subvolume of BTRFS?

Ropid wrote:

You need to look through the output of this:

btrfs subvolume list /mnt

or shorter:

btrfs su l /mnt

Thank you!
After entering the command btrfs subvolume list /mnt

# btrfs subvolume list /mnt
ID 257 gen 1412 top level 5 path root_bad
ID 258 gen 2745 top level 5 path home
ID 260 gen 1381 top level 257 path root_bad/var/lib/machines
ID 262 gen 1399 top level 5 path Only_YADRO
ID 263 gen 2745 top level 5 path root
ID 272 gen 1416 top level 5 path i3

I saw that subvolume with ID 260 belong subvolume with ID 257 and if i will delete subvolume "machines" and after i will can easily delete subvolume "root_bad". DONE, THANKS!!!

Offline

Board footer

Powered by FluxBB