Skip to contentSkip to conversation

Can't remove read-only snapshot with immutable flag set

DISCUSSION cdlscpmv 3 participants 4 messages Jun 8, 2016 Btrfs file system

lore
Share & tools
lore

cdlscpmv

author
#0 lore raw

Hi!

It happened that I set the immutable flag (via chattr +i) on a subvolume. Then I made a read-only snapshot of that subvolume. Now I can't remove this snapshot.

#> btrfs subvolume delete my_snapshot
Delete subvolume (no-commit): 'my_snapshot'
ERROR: cannot delete 'my_snapshot': Operation not permitted #> chattr -i my_snapshot
chattr: Read-only file system while setting flags on my_snapshot #> btrfs --version
btrfs-progs v4.4.1
#> uname -r
4.5.2

Is there any other way to do this? Or is it a bug?

#1 lore raw
Quoted 14 lines · On Wed, 8 Jun 2016 08:37:57 +0000 cdlscpmv <[email protected]> wrote:

It happened that I set the immutable flag (via chattr +i) on a subvolume. Then I made a read-only snapshot of that subvolume. Now I can't remove this snapshot.

#> btrfs subvolume delete my_snapshot
Delete subvolume (no-commit): 'my_snapshot'
ERROR: cannot delete 'my_snapshot': Operation not permitted #> chattr -i my_snapshot
chattr: Read-only file system while setting flags on my_snapshot #> btrfs --version
btrfs-progs v4.4.1
#> uname -r
4.5.2

Quoted 1 line

Is there any other way to do this? Or is it a bug?

You could try doing:

btrfs property set my_snapshot ro false

normally this should change it to a read-write snapshot. But it seems like changing btrfs properties is also blocked by chattr +i (at least I can't change compression methods on a +i file).

Signature · 2 lines
With respect,
Roman
#2 lore raw
In reply to cdlscpmv
Quoted 17 lines · cdlscpmv

Hi!

It happened that I set the immutable flag (via chattr +i) on a subvolume. Then I made a read-only snapshot of that subvolume. Now I can't remove this snapshot.

#> btrfs subvolume delete my_snapshot
Delete subvolume (no-commit): 'my_snapshot'
ERROR: cannot delete 'my_snapshot': Operation not permitted #> chattr -i my_snapshot
chattr: Read-only file system while setting flags on my_snapshot #> btrfs --version
btrfs-progs v4.4.1
#> uname -r
4.5.2

Quoted 2 lines

Is there any other way to do this? Or is it a bug?

Try
#> btrfs property set my_snaphot ro false
#> chattr -i my_snapshot
#> btrfs sub del my_snapshot

author
#3 lore raw
Quoted 18 lines · Noah Massey
Quoted 17 lines · cdlscpmv

Hi!

It happened that I set the immutable flag (via chattr +i) on a subvolume. Then I made a read-only snapshot of that subvolume. Now I can't remove this snapshot.

#> btrfs subvolume delete my_snapshot
Delete subvolume (no-commit): 'my_snapshot'
ERROR: cannot delete 'my_snapshot': Operation not permitted #> chattr -i my_snapshot
chattr: Read-only file system while setting flags on my_snapshot #> btrfs --version
btrfs-progs v4.4.1
#> uname -r
4.5.2

Quoted 6 lines
Quoted 2 lines

Is there any other way to do this? Or is it a bug?

Try
#> btrfs property set my_snaphot ro false
#> chattr -i my_snapshot
#> btrfs sub del my_snapshot

I've already tried that. It worked. Nevertheless, thanks for the reply!