Skip to contentSkip to conversation

Using autofs with on non-mounted directory

DISCUSSION Lukas Haase 3 participants 4 messages Aug 19, 2009 – Aug 31, 2009 Kernel automounter

lore
Share & tools
lore
#0 lore raw

Hi,

I have the problem that I have an indirect mount in "/var/lib/vz/root/500/media/media". Unfortunately this directory does not always exists (particulary not on system startup).

The directory exists as soon as another filesystem "/var/lib/vz/root/500" is mounted. I have the possibility to execute a script when that filesystem is mounted and umounted.

Do I have the possibility to add/remove this indirect mount somehow "on the fly"?

So I would start autofs without that particular indirect mount and add it only as soon as /var/lib/vz/root/500 is mounted. Before it is unmounted, the indirect mount could be removed as well.

Regards,
Luke

#1 lore raw
Quoted 5 lines · Lukas Haase

Hi,

I have the problem that I have an indirect mount in "/var/lib/vz/root/500/media/media". Unfortunately this directory does not always exists (particulary not on system startup).

So it doesn't get mounted automatically? If it *is* mounted as part of startup, then it sounds like you just need to move that sooner in your boot order.

Quoted 6 lines

The directory exists as soon as another filesystem "/var/lib/vz/root/500" is mounted. I have the possibility to execute a script when that filesystem is mounted and umounted.

Do I have the possibility to add/remove this indirect mount somehow "on the fly"?

You would have to script this yourself. There is no real api to tell the automounter to add map entries.

Cheers,
Jeff

#2 lore raw
Quoted 2 lines · Jeff Moyer
Quoted 1 line · Lukas Haase

Hi,

Hi,

Quoted 7 lines
Quoted 3 lines

I have the problem that I have an indirect mount in "/var/lib/vz/root/500/media/media". Unfortunately this directory does not always exists (particulary not on system startup).

So it doesn't get mounted automatically? If it *is* mounted as part of startup, then it sounds like you just need to move that sooner in your boot order.

No, that would be easy, of course. The actual problem is, that I want to have the indirect mount into an OpenVZ container. OpenVZ "bind mounts" its data root into the directory above before starting a container: /var/lib/vz/private/500/media/media --> /var/lib/vz/root/500/media/media.

And of course, the container is not always started. But I can call a script when starting/stopping a container.

Quoted 9 lines
Quoted 6 lines

The directory exists as soon as another filesystem "/var/lib/vz/root/500" is mounted. I have the possibility to execute a script when that filesystem is mounted and umounted.

Do I have the possibility to add/remove this indirect mount somehow "on the fly"?

You would have to script this yourself. There is no real api to tell the automounter to add map entries.

Yes, but how?

Would it be possible to change the config files and send e.g. a HUP ?

That way, I could dynamically add the apropriate line on container startup and issue HUP, and remove the line when the container shuts down.

Regards,
Luke

maintainer
#3 lore raw
Quoted 29 lines · Lukas Haase
Quoted 2 lines · Jeff Moyer
Quoted 1 line · Lukas Haase

Hi,

Hi,

Quoted 7 lines
Quoted 3 lines

I have the problem that I have an indirect mount in "/var/lib/vz/root/500/media/media". Unfortunately this directory does not always exists (particulary not on system startup).

So it doesn't get mounted automatically? If it *is* mounted as part of startup, then it sounds like you just need to move that sooner in your boot order.

No, that would be easy, of course. The actual problem is, that I want to have the indirect mount into an OpenVZ container. OpenVZ "bind mounts" its data root into the directory above before starting a container:
/var/lib/vz/private/500/media/media --> /var/lib/vz/root/500/media/media.

And of course, the container is not always started. But I can call a script when starting/stopping a container.

Quoted 7 lines
Quoted 6 lines

The directory exists as soon as another filesystem "/var/lib/vz/root/500" is mounted. I have the possibility to execute a script when that filesystem is mounted and umounted.

Do I have the possibility to add/remove this indirect mount somehow "on the fly"?

Quoted 6 lines
Quoted 2 lines

You would have to script this yourself. There is no real api to tell the automounter to add map entries.

Yes, but how?

Would it be possible to change the config files and send e.g. a HUP ?

Yep, HUP tells autofs to re-read it's maps.

Quoted 11 lines

That way, I could dynamically add the apropriate line on container startup and issue HUP, and remove the line when the container shuts down.

Regards,
Luke

_______________________________________________
autofs mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/autofs