Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFE: X-mount.subdir= or so? #1103

Closed
poettering opened this issue Jul 14, 2020 · 0 comments
Closed

RFE: X-mount.subdir= or so? #1103

poettering opened this issue Jul 14, 2020 · 0 comments
Labels
TODO We going to think about it ;-)

Comments

@poettering
Copy link
Contributor

I think it would be fantastic if one could use a simple mount command to mount a subdir of some file system, instead of the root. i.e.

mount /dev/sda6 -t ext4 /foo/bar -o X-mount.subdir=/waldo/quux

Which would internally open a new mount namespace, create a temporary directory in /tmp, turn off propagation for it, then mount /dev/sda6 into it (so that it won't be visible in the host namespace), then use the /wald/quux subdir of it and bind mount it to host's /foo/bar, and exit. The namespace and the mount of the root of the file system will then be cleaned up. so that the rest of the system only sees the /foo/bar mount show up, atomically.

This would be be a more generic version of btrfs' subvol= switch: it would work for all file system types, and for all directories, not just subvolumes.

There are many usecases thinkable, including many where btrf's subvol= mount option is useful. But others come to mind:

  1. You format a file system, and want to mount it somewhere, but want to avoid lost+found to show up. So you create a subdir in it, and just want to use that. lost+found would then still exist but never show up
  2. systemd-homed can manage user's home directories inside LUKS volumes. It places the home directory inside a subdir inside the file systems inside them, and with the above suggested switch one can mount the home directory with one line.
  3. One could mount specific ostree hierarchies right away without any further work.

and so on.

@karelzak karelzak added the TODO We going to think about it ;-) label Jul 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TODO We going to think about it ;-)
Projects
None yet
Development

No branches or pull requests

2 participants