You are not logged in.
Pages: 1
It's possible to have a btrfs filesystem mounted read-write while a subvolume is mounted read-only:
filesystem: rw
subvolume: roI can remount the subvolume read-write:
filesystem: rw
subvolume: rwBut when I subsequently try to remount the subvolume read-only again, the whole filesystem also gets remounted read-only:
filesystem: ro
subvolume: roYet unmounting the subvolume and mounting it read-only gives what I asked for:
filesystem: rw
subvolume: roWhy doesn't remounting give the same result as umounting and mounting again? Is it a bug? A design (mis)decision? The man 5 btrfs manpage does not shed any light on the matter.
Last edited by PBS (2021-12-20 07:09:41)
Offline
Other notes:
See this question for how to try it yourself.
This patch seems closely related, but is outdated.
The error messages become silly if the filesystem is your root filesystem. Then remounting the subvolume read-only fails with "mount point is busy". But it's not, because you can unmount it.
One might think remounting the subvolume with all the original mount options (only adding remount,ro) would fix things. It doesn't.
Different versions of the same question:
BTRFS subvolume can't be remounted read-only - no answers.
Nested subvolumes and mount -o remount applying options to all subvolumes - no informed answers.
mount policy for subvols if root is remount,ro - raised by a btrfs developer on the btrfs mailing list, and it went nowhere.
Cannot remount root subvolume read-only - related, also on btrfs mailing list. Rather more seriously, this also means btrfs does not respect the remount-readonly magic sysrq key.
Last edited by PBS (2021-12-20 06:51:13)
Offline
Try
mount -o remount,ro,subvol=$subvol,bind /$mountpointJin, Jîyan, Azadî
Offline
Try
mount -o remount,ro,subvol=$subvol,bind /$mountpoint
Yes, sticking bind in the mount options makes it work. I suppose that's because btrfs subvolumes are really implemented over bind mounts.
That solves my original problem. The troubling issue that btrfs ignores sysrq+U remains, though that is an entirely separate topic.
Offline
I suppose that's because btrfs subvolumes are really implemented over bind mounts.
Correcting myself, it has nothing to do with subvolumes being implemented over bind mounts, and works for any mount. In fact, man 2 mount clearly states that "remount,bind" is the preferred way to change the mount options of an existing mount. (Despite that, it doesn't work for systemd-automounts, and you have to use plain old "remount" for them, but that's another mystery.)
I also notice that the example given in the man page,
mount --bind olddir newdir mount -o remount,bind,ro olddir newdirseems to be missing a line break.
Last edited by PBS (2021-12-20 15:36:29)
Offline
Pages: 1