Re: subvols, ro- and bind mounts - how?
On Thu, 2015-12-10 at 19:32 -0700, Chris Murphy wrote: > That seems due for a revision because I do rw, ro, rw, rw, ro mounts > in sequence and they stick fine. In fact they stick with the same > subvolume. > > [root@f23m ]# mount /dev/sda7 /mnt/1 -o subvol=home > [root@f23m ]# mount /dev/sda7 /mnt/2 -o subvol=home,ro > [root@f23m ]# mount /dev/sda7 /mnt/3 -o subvol=home > [root@f23m ]# mount > [...snip...] > /dev/sda7 on /mnt/1 type btrfs > (rw,relatime,seclabel,ssd,space_cache,subvolid=258,subvol=/home) > /dev/sda7 on /mnt/2 type btrfs > (ro,relatime,seclabel,ssd,space_cache,subvolid=258,subvol=/home) > /dev/sda7 on /mnt/3 type btrfs > (rw,relatime,seclabel,ssd,space_cache,subvolid=258,subvol=/home) Not sure what you mean with "stick" here... I'd say the above has simply the following semantics: - the default for mounts is rw - thus /mnt/1 and /mnt/3 are rw, and 3 isn't rw, because 1 was In other words, if you change that to the following: # mount /dev/sda7 /mnt/1 -o subvol=home,ro # mount /dev/sda7 /mnt/2 -o subvol=home,ro # mount /dev/sda7 /mnt/3 -o subvol=home I'd expect that you get ro ro rw At least based on how I understood the whole system now. That was actually my question here: Q: In other words does mounting the same subvol *again* behave like -- bind mounts, i.e. the further mounts would get the options from the first mount? And I guess the A:(nswer) is: no, mount options affect the respective mountpoint (including any nested subvols below that) only (except of course it's a --bind mount. If one of the devs could confirm that semantics, I may find some time to update the wiki accordingly. Cheers, Chris. smime.p7s Description: S/MIME cryptographic signature
Re: subvols, ro- and bind mounts - how?
Hey. I'd have an additional question about subvols O:-) Given the following setup: 5 | +--root (subvol, /) +-- mnt (dir) with the following done: - init 1 - remount,ro / (i.e. the subvol root) - mount /dev/btrfs-device /mnt (i.e. mount the top subvol at /mnt) The following happened: - / was ro-mounted (obviously, at least one thing that I had expected correctly) - /mnt was ro-mounted either (and the /mnt/root/ nested subvol then as well). => why is /mnt (i.e. the top level subvol) mounted ro?? => I would have expected that, since / (i.e. the subvol "root" is ro mounted), it's also ro mounted as the nested subvol below 5, i.e. my naive thinking was in terms of logic: "/ mounted ro" => "subvol root is mounted ro (everywhere)" => "thus /mnt/root/ is mounted ro as well" However, the later doesn't seem to be true, cause then I did: - remount,rw /mnt => now /mnt/*, including /mnt/root/* was rw moutned So I guess my assumption of subvols behaving more or less as if they'd be a fs (and thus mounted at one place ro => everywhere ro) is not true, is it? Do, ro,rw (and possibly others) instead only affect the respective mountpoint? And automatically any nested subvols of that mountpoint? So I could have basically: /mount-point1/subvol-a ; ro, noexec /mount-point2/subvol-a ; rw, compress=yes /root ; rw, compress=no /root/here/it/is/nested/subvol-a ; (no mountpoint) (with subvol-a being the same subvol) And when I write via mount-point1 I'd get an error, but via mount- point2 it works and in addition I get compression, while when writing via the /root mountpoint, where it is nested, I'd get the rw and compress=no from the "parent" mountpoint /root Does that sounds correct? It seems to make sense actually, though it's a bit unfamiliar... if I'm not correctly wrong, than e.g. in terms of ext* I cannot have the same fs mounted with different settings,... of course I cannot have it mounted twice at all, but speaking of bind mounts. So I guess, that when I'd do --bind mounts instead, I actually do get the "old" behaviour, i.e. when the source is ro, then the --bind mount's target is also forcibly ro. Still, one unclear thing, why got /mnt mounted ro very above? Thanks, Chris. btw: Not sure if I just missed it, but I guess the above should be more or less documented, showing people that mounting subvols (especially when mounting the same several times, either directly or as nested subvol) has these implications. smime.p7s Description: S/MIME cryptographic signature
Re: subvols, ro- and bind mounts - how?
Hey. I'd have an additional question about subvols O:-) Given the following setup: 5 | +--root (subvol, /) +-- mnt (dir) with the following done: - init 1 - remount,ro / (i.e. the subvol root) - mount /dev/btrfs-device /mnt (i.e. mount the top subvol at /mnt) The following happened: - / was ro-mounted (obviously, at least one thing that I had expected correctly) - /mnt was ro-mounted either (and the /mnt/root/ nested subvol then as well). => why is /mnt (i.e. the top level subvol) mounted ro?? => I would have expected that, since / (i.e. the subvol "root" is ro mounted), it's also ro mounted as the nested subvol below 5, i.e. my naive thinking was in terms of logic: "/ mounted ro" => "subvol root is mounted ro (everywhere)" => "thus /mnt/root/ is mounted ro as well" However, the later doesn't seem to be true, cause then I did: - remount,rw /mnt => now /mnt/*, including /mnt/root/* was rw moutned So I guess my assumption of subvols behaving more or less as if they'd be a fs (and thus mounted at one place ro => everywhere ro) is not true, is it? Do, ro,rw (and possibly others) instead only affect the respective mountpoint? And automatically any nested subvols of that mountpoint? So I could have basically: /mount-point1/subvol-a ; ro, noexec /mount-point2/subvol-a ; rw, compress=yes /root ; rw, compress=no /root/here/it/is/nested/subvol-a ; (no mountpoint) (with subvol-a being the same subvol) And when I write via mount-point1 I'd get an error, but via mount- point2 it works and in addition I get compression, while when writing via the /root mountpoint, where it is nested, I'd get the rw and compress=no from the "parent" mountpoint /root Does that sounds correct? It seems to make sense actually, though it's a bit unfamiliar... if I'm not correctly wrong, than e.g. in terms of ext* I cannot have the same fs mounted with different settings,... of course I cannot have it mounted twice at all, but speaking of bind mounts. So I guess, that when I'd do --bind mounts instead, I actually do get the "old" behaviour, i.e. when the source is ro, then the --bind mount's target is also forcibly ro. Still, one unclear thing, why got /mnt mounted ro very above? Thanks, Chris. btw: Not sure if I just missed it, but I guess the above should be more or less documented, showing people that mounting subvols (especially when mounting the same several times, either directly or as nested subvol) has these implications. Quote: " Most mount options apply to the whole filesystem, and only the options for the first subvolume to be mounted will take effect. This is due to lack of implementation and may change in the future. " from https://btrfs.wiki.kernel.org/index.php/Mount_options in a red box on the top. -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: subvols, ro- and bind mounts - how?
On Thu, 2015-12-10 at 23:36 +0100, S.J. wrote: > Quote: > > " Most mount options apply to the whole filesystem, and only the > options > for the first subvolume > to be mounted will take effect. This is due to lack of implementation > and may change in the future. " > > from https://btrfs.wiki.kernel.org/index.php/Mount_options in a red > box > on the top. I've had read that, but it doesn't really make clear that that options can effectively differ for the *same* subvol, when mounted several times (or when appearing additionally as nested subvolume). Chris. smime.p7s Description: S/MIME cryptographic signature
Re: subvols, ro- and bind mounts - how?
On Thu, Dec 10, 2015 at 3:36 PM, S.J.wrote: > Quote: > > " Most mount options apply to the whole filesystem, and only the options for > the first subvolume > to be mounted will take effect. This is due to lack of implementation and > may change in the future. " > > from https://btrfs.wiki.kernel.org/index.php/Mount_options in a red box on > the top. That seems due for a revision because I do rw, ro, rw, rw, ro mounts in sequence and they stick fine. In fact they stick with the same subvolume. [root@f23m ]# mount /dev/sda7 /mnt/1 -o subvol=home [root@f23m ]# mount /dev/sda7 /mnt/2 -o subvol=home,ro [root@f23m ]# mount /dev/sda7 /mnt/3 -o subvol=home [root@f23m ]# mount [...snip...] /dev/sda7 on /mnt/1 type btrfs (rw,relatime,seclabel,ssd,space_cache,subvolid=258,subvol=/home) /dev/sda7 on /mnt/2 type btrfs (ro,relatime,seclabel,ssd,space_cache,subvolid=258,subvol=/home) /dev/sda7 on /mnt/3 type btrfs (rw,relatime,seclabel,ssd,space_cache,subvolid=258,subvol=/home) And Project Atomic, a.k.a. ostree and rpm-ostree etc., depend on mounting different parts of the same fs volume to different mounts points with different read and read/write settings (bind mounts), and that works too. http://projectatomic.io/ -- Chris Murphy -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html