Re: Is it safe to mount subvolumes of already-mounted volumes (even with different options)?
Hello, I need to clarify, I'm _not_ sharing a drive between multiple computers at the _same_ time. It's a portable device which I use at different locations with different computers. I just wanted to give a rationale for mounting the whole drive to some mountpoint and then also part of that drive (a subvolume) to the respective computer's /home mountpoint. So it's controlled by the same kernel in the same computer, it's just that part of the filesystem is mounted at multiple mountpoints, much like a bind-mount, but I'm interested in mounting a subvolume of the already-mounted volume to some other mountpoint. Sorry for the confusion. Best regards Sebastian On 17.07.2014 01:18, Chris Murphy wrote: On Jul 16, 2014, at 4:18 PM, Sebastian Ochmann ochm...@informatik.uni-bonn.de wrote: Hello, I'm sharing a btrfs-formatted drive between multiple computers and each of the machines has a separate home directory on that drive. 2+ computers writing to the same block device? I don't see how this is safe. Seems possibly a bug that the 1st mount event isn't setting some metadata so that another kernel instance knows not to allow another mount. 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
Re: Is it safe to mount subvolumes of already-mounted volumes (even with different options)?
On Thu, Jul 17, 2014 at 12:18:37AM +0200, Sebastian Ochmann wrote: I'm sharing a btrfs-formatted drive between multiple computers and each of the machines has a separate home directory on that drive. The root of the drive is mounted at /mnt/tray and the home directory for machine {hostname} is under /mnt/tray/Homes/{hostname}. Up until now, I have mounted /mnt/tray like a normal volume and then did an additional bind-mount of /mnt/tray/Homes/{hostname} to /home. You've said you're not sharing it concurrently, which is good -- as long as you've only got one machine accessing it at the same time, you're fine there. Now I have a new drive and wanted to do things a bit more advanced by creating subvolumes for each of the machines' home directories so that I can also do independent snapshotting. I guess I could use the bind-mount method like before but my question is if it is considered safe to do an additional, regular mount of one of the subvolumes to /home instead, like mount /dev/sdxN /mnt/tray mount -o subvol=/Homes/{hostname} /dev/sdxN /home When I experimented with such additional mounts of subvolumes of already-mounted volumes, I noticed that the mount options of the additional subvolume mount might differ from the original mount. For instance, the root volume might be mounted with noatime while the subvolume mount may have relatime. So my questions are: Is mounting a subvolume of an already mounted volume considered safe Yes, absolutely: hrm@amelia:~$ mount | grep btrfs /dev/sda2 on /boot type btrfs (rw,noatime,space_cache) /dev/sda2 on /home type btrfs (rw,noatime,space_cache) /dev/sda2 on /media/video type btrfs (rw,noatime,space_cache) /dev/sda2 on /media/pipeline type btrfs (rw,noatime,space_cache) /dev/sda2 on /media/snarf type btrfs (rw,noatime,space_cache) /dev/sda2 on /media/audio type btrfs (rw,noatime,space_cache) /dev/sda2 on /srv/nfs/home type btrfs (rw,noatime,space_cache) /dev/sda2 on /srv/nfs/video type btrfs (rw,noatime,space_cache) /dev/sda2 on /srv/nfs/testing type btrfs (rw,noatime,space_cache) /dev/sda2 on /srv/nfs/pipeline type btrfs (rw,noatime,space_cache) /dev/sda2 on /srv/nfs/audio type btrfs (rw,noatime,space_cache) /dev/sda2 on /srv/nfs/nadja type btrfs (rw,noatime,space_cache) and are there any combinations of possibly conflicting mount options one should be aware of (compression, autodefrag, cache clearing)? Is it advisable to use the same mount options for all mounts pointing to the same physical device? If you assume that the first mount options are the ones used for everything, regardless of any different options provided in subsequent mounts, then you probably won't go far wrong. It's not quite true: some options do work on a per-mount basis, but most are per-filesystem. I'm sure there was a list of them on the wiki at some point, but I can't seem to track it down right now. Hugo. -- === Hugo Mills: hugo@... carfax.org.uk | darksatanic.net | lug.org.uk === PGP key: 65E74AC0 from wwwkeys.eu.pgp.net or http://www.carfax.org.uk --- Try everything once, except incest and folk-dancing. --- signature.asc Description: Digital signature
Re: Is it safe to mount subvolumes of already-mounted volumes (even with different options)?
Original Message Subject: Re: Is it safe to mount subvolumes of already-mounted volumes (even with different options)? From: Sebastian Ochmann ochm...@informatik.uni-bonn.de To: Chris Murphy li...@colorremedies.com, zhe.zhang.resea...@gmail.com Date: 2014年07月17日 15:58 Hello, I need to clarify, I'm _not_ sharing a drive between multiple computers at the _same_ time. It's a portable device which I use at different locations with different computers. I just wanted to give a rationale for mounting the whole drive to some mountpoint and then also part of that drive (a subvolume) to the respective computer's /home mountpoint. So it's controlled by the same kernel in the same computer, it's just that part of the filesystem is mounted at multiple mountpoints, much like a bind-mount, but I'm interested in mounting a subvolume of the already-mounted volume to some other mountpoint. Sorry for the confusion. Best regards Sebastian If you mean something like the following use case: # mount /dev/sdb1 -o subvolid=257 /home # mount /dev/sdb1 -o subvolid=5 /some/other/place That is completly OK. But when it comes to different mount option, especially different ro/rw mount option, although it is working for 3.16-rc*, the ro/rw mount option is still under disscussion and the current rc implement will cause a kernel warning mounting a subvolume rw when it's first mounted as ro. So in short: 1) mount subvolumes when the btrfs fs is already mounted. Completly OK. 2) different mount option for different subvolume in one btrfs fs. For most mount option including ro/rw, No. Thanks, Qu On 17.07.2014 01:18, Chris Murphy wrote: On Jul 16, 2014, at 4:18 PM, Sebastian Ochmann ochm...@informatik.uni-bonn.de wrote: Hello, I'm sharing a btrfs-formatted drive between multiple computers and each of the machines has a separate home directory on that drive. 2+ computers writing to the same block device? I don't see how this is safe. Seems possibly a bug that the 1st mount event isn't setting some metadata so that another kernel instance knows not to allow another mount. 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 -- 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: Is it safe to mount subvolumes of already-mounted volumes (even with different options)?
Hugo Mills posted on Thu, 17 Jul 2014 09:41:53 +0100 as excerpted: and are there any combinations of possibly conflicting mount options one should be aware of (compression, autodefrag, cache clearing)? Is it advisable to use the same mount options for all mounts pointing to the same physical device? If you assume that the first mount options are the ones used for everything, regardless of any different options provided in subsequent mounts, then you probably won't go far wrong. It's not quite true: some options do work on a per-mount basis, but most are per-filesystem. I'm sure there was a list of them on the wiki at some point, but I can't seem to track it down right now. IIRC/AFAIK, the btrfs-specific mount options should be per filesystem, while stuff like relatime vs noatime is VFS level and should work per subvolume. There's actually a current discussion about ro vs rw. Consider the case of a parent subvolume (perhaps but not necessarily the root subvolume, id=5), being mounted writable in one location, with a child mounted elsewhere read-only. Because it's possible to browse in the parent's subvolume down into the child subvolume as well, and someone could write a file there, that write would then show up in the elsewhere mounted read- only child subvolume as well. That's unexpected behavior to say the least! Normally, read-only means it cannot and will not change, but in this case it wouldn't mean that at all! My idea is that the same rules should apply to ro/rw as apply to btrfs snapshots -- they stop at subvolume borders. Any write into a child subvolume would thus throw an error, regardless of how the parent subvolume was mounted. The only way to write into a subvolume would be to mount it read-write on its own. That would solve the ambiguity, but it would also be quite a change from existing behavior, where a read- write mount of the root subvolume can write into any subvolume. Someone else suggested that we separate filesystem read-write from subvolume read-write. There's already the concept of read-only snapshots, used in btrfs-send, for one thing. The idea here would be that a read-only filesystem/root mount means the entire filesystem is read-only, but provided the filesystem/root was mounted read-write, individual subvolumes could be mounted read-only using a different option, subv=ro, or similar, which would be hooked into the existing read- only subvolume mechanism. In that case, if the filesystem/root was read- write, then the subvolume specific rw/ro mount option would take precedence and would trigger an error on write to that subvolume even if written from the read-write parent mount. But while btrfs is the first filesystem to do this sort of thing and thus to deal with the problem, it might not be the last, so policy coordination with the VFS layer should be considered and a generic kernel policy for any filesystem dealing with subvolumes should be established. IOW, it's bigger than simply btrfs. So anyway, while there was a patch applied earlier that did allow different read-only/read-write subvolume mounts, I believe that's reverted for 3.16, while this discussion continues and until it gets resolved one way or another, possibly at a kernel conference or the like. But I believe generic VFS stuff like noatime/relatime/atime and dev/nodev/ suid/nosuid/exec/noexec is fine per-subvolume, because that's enforced at the VFS layer and there's no internal or expectation inconsistency to worry about if you can access for example the same device-file as a device via one mountpoint and not by another. -- Duncan - List replies preferred. No HTML msgs. Every nonfree program has a lord, a master -- and if you use the program, he is your master. Richard Stallman -- 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
Is it safe to mount subvolumes of already-mounted volumes (even with different options)?
Hello, I'm sharing a btrfs-formatted drive between multiple computers and each of the machines has a separate home directory on that drive. The root of the drive is mounted at /mnt/tray and the home directory for machine {hostname} is under /mnt/tray/Homes/{hostname}. Up until now, I have mounted /mnt/tray like a normal volume and then did an additional bind-mount of /mnt/tray/Homes/{hostname} to /home. Now I have a new drive and wanted to do things a bit more advanced by creating subvolumes for each of the machines' home directories so that I can also do independent snapshotting. I guess I could use the bind-mount method like before but my question is if it is considered safe to do an additional, regular mount of one of the subvolumes to /home instead, like mount /dev/sdxN /mnt/tray mount -o subvol=/Homes/{hostname} /dev/sdxN /home When I experimented with such additional mounts of subvolumes of already-mounted volumes, I noticed that the mount options of the additional subvolume mount might differ from the original mount. For instance, the root volume might be mounted with noatime while the subvolume mount may have relatime. So my questions are: Is mounting a subvolume of an already mounted volume considered safe and are there any combinations of possibly conflicting mount options one should be aware of (compression, autodefrag, cache clearing)? Is it advisable to use the same mount options for all mounts pointing to the same physical device? Best regards, Sebastian -- 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: Is it safe to mount subvolumes of already-mounted volumes (even with different options)?
On Jul 16, 2014, at 4:18 PM, Sebastian Ochmann ochm...@informatik.uni-bonn.de wrote: Hello, I'm sharing a btrfs-formatted drive between multiple computers and each of the machines has a separate home directory on that drive. 2+ computers writing to the same block device? I don't see how this is safe. Seems possibly a bug that the 1st mount event isn't setting some metadata so that another kernel instance knows not to allow another mount. 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
Re: Is it safe to mount subvolumes of already-mounted volumes (even with different options)?
Hi Sebastian, I posted a similar question and got many helpful answers: https://www.mail-archive.com/linux-btrfs@vger.kernel.org/msg35047.html Basically, you cannot guarantee that the computing mounting /dev/sdx doesn't write to arbitrary addresses of /dev/sdxN as unallocated blocks and thus corrupting the file system on it (I assume sdxN in your example is a sub volume of sdx). On Wed, Jul 16, 2014 at 6:18 PM, Sebastian Ochmann ochm...@informatik.uni-bonn.de wrote: Hello, I'm sharing a btrfs-formatted drive between multiple computers and each of the machines has a separate home directory on that drive. The root of the drive is mounted at /mnt/tray and the home directory for machine {hostname} is under /mnt/tray/Homes/{hostname}. Up until now, I have mounted /mnt/tray like a normal volume and then did an additional bind-mount of /mnt/tray/Homes/{hostname} to /home. Now I have a new drive and wanted to do things a bit more advanced by creating subvolumes for each of the machines' home directories so that I can also do independent snapshotting. I guess I could use the bind-mount method like before but my question is if it is considered safe to do an additional, regular mount of one of the subvolumes to /home instead, like mount /dev/sdxN /mnt/tray mount -o subvol=/Homes/{hostname} /dev/sdxN /home When I experimented with such additional mounts of subvolumes of already-mounted volumes, I noticed that the mount options of the additional subvolume mount might differ from the original mount. For instance, the root volume might be mounted with noatime while the subvolume mount may have relatime. So my questions are: Is mounting a subvolume of an already mounted volume considered safe and are there any combinations of possibly conflicting mount options one should be aware of (compression, autodefrag, cache clearing)? Is it advisable to use the same mount options for all mounts pointing to the same physical device? Best regards, Sebastian -- 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 -- 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