User: Password:
|
|
Subscribe / Log in / New account

Unifying filesystems with union mounts

Unifying filesystems with union mounts

Posted Jan 10, 2009 3:11 UTC (Sat) by willp (guest, #52971)
Parent article: Unifying filesystems with union mounts

"All writes are directed to the topmost mounted filesystem..."

This seems really obscure to me. So, if you union-mount everything onto the / mountpoint, then if you 'mkdir /blah' it gets created on the first (true root) partition, and you have no way to change that -- ever after bootup? Or am I confused?

If the choice of which device gets the writes is determined by the mount-order, won't that lead to some really strange work flows? I'm thinking, suppose we have:

# at bootup, from fstab processing
mount /dev/sda1 /
mount --union /dev/sda2 / (contains /opt)
mount --union /dev/sda3 / (contains /opt/whatever)

If you need to perform an fsck on /dev/sda2 for some reason, because of hardware issues or something, then you would want to unmount /opt then do an fsck on /dev/sda2, then remount it...

BUT! If you did that, you would inadvertently change the behavior of "mkdir /opt/foo" so that it gets created on /dev/sda3 AFTER the fsck and remount, versus being created on /dev/sda2 BEFORE the fsck and remount... Or am I misunderstanding this...?

It seems to me that implicit behavior is far more risky than explicit behavior. I'd ammend the idea of union mounts with an explicit numeric ordering that you specify with the --union option, like:
mount --union=1 /dev/sda2 / (contains /opt)
mount --union=2 /dev/sda3 / (contains /opt/whatever)

Then when you unmount /dev/sda2, and then remount it, you could specify the --union=1 option to restore /dev/sda2 to its ranking(ordering) with respect to the other devices mounted on the same mountpoint... And if you specify an ordering value that is already "in-use", then the 'mount' command could exit and abort with an error message.

It just seems like a huge risk to incur to have regular maintenance (umount,fsck,mount) lead to unexpected changes in the behavior of basic filesystem operations like mkdir. Especially if it's easily solved with an explicit numeric ordering provided by the admin.

Boy, I hope I'm just really ignorant here and missing something obvious... Anyone able to correct me here and allay my concern?


(Log in to post comments)

Unifying filesystems with union mounts

Posted Jan 10, 2009 4:23 UTC (Sat) by dlang (subscriber, #313) [Link]

you wouldn't use union mounts to mount /, /opt, /opt/whatever

you would use union mounts to mount three different filesystems on /opt/whatever

and yes, all your writes would land in the top filesystem.

to work on a lower-level filesystem you would need to unmount the layers on top of it, and to get back where you started you would need to remount the layers above.

if you write something on one filesystem, but decide you want it on the filesystem below that, you would need to unmount the top layer, mount it somewhere else, and move the file from one filesystem to the other.

I don't understand why you think you would need to mount them in a different order.

if you have dev/1 over dev/2 and decide that they should be in the other order just unmount them and re-mount them in the other order.

your filesystem is already dependant on the order that you mount things today.

if you mount /dev/1 on /opt and then mount /dev/2 on opt you will see the files in /dev/2 and not /dev/1, if you mount them in the other order you will see the files in /dev/1 but not in /dev/2


Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds