Skip to contentSkip to conversation

cannot move ro-snapshot directly but indirectly works

DISCUSSION Christoph Anton Mitterer 2 participants 2 messages Nov 28, 2015 Btrfs file system

lore
Share & tools
lore
#0 lore raw

Hey.

Not sure whether this is intended or not, but it feels at least somewhat strange:

Consider I have a readonly snapshot (the only subvol here):
/btrfs/snapshots/ro-snapshot
now I want to move it to the dir:
/btrfs/snapshots/foo/
i.e.
mv /btrfs/snapshots/ro-snapshot /btrfs/snapshots/foo/
but the mv complains about read-only filesystem.

However I can do something like:
mkdir /btrfs/tmp
mv  /btrfs/snapshots /btrfs/tmp/
mv /btrfs/tmp /btrfs/snapshots
mv /btrfs/snapshots/snapshots /btrfs/snapshots/foo which would give me just the dir structure I tried to get before.

Long story short... I don't get why one cannot move a ro-snapshot directly, when one can move it indirectly in the fs-hierarchy.

Cheers,
Chris.

#1 lore raw
Quoted 6 lines · On Fri, Nov 27, 2015 at 22:06 Christoph Anton Mitterer <[email protected]>…

Hey.

Not sure whether this is intended or not, but it feels at least somewhat strange:

Quoted 9 lines

Consider I have a readonly snapshot (the only subvol here):
/btrfs/snapshots/ro-snapshot
now I want to move it to the dir:
/btrfs/snapshots/foo/
i.e.
mv /btrfs/snapshots/ro-snapshot /btrfs/snapshots/foo/
but the mv complains about read-only filesystem.

Not a developer, but I believe this is intended behavior. Changing the direct parent directory of a subvolume is not a read only
operation: it involves modifying the '..' directory entry. Renaming the subvolume, or moving the parent directory, modify the overall fs-hierachy, but do not modify the subvol.

The same is true for normal directories:
mkdir /tmp/dir1
chmod -w /tmp/dir1
mv /tmp/dir1 /tmp/dir2 ## allowed
mkdir /tmp/dir3
mv /tmp/dir2 /tmp/dir3/dir2 ## Permission denied

~ Noah