Skip to contentSkip to conversation

Mounting a usb flash drive on /mnt

DISCUSSION Derek Reid 3 participants 5 messages Apr 19, 2007 – Apr 30, 2007 Kernel automounter

lore
Share & tools
lore

Derek Reid

author
#0 lore raw

Hi,

I'd like to mount my usb flash drive exclusively on /mnt but I'm not sure if this is possible.

From the docs, it looks like /etc/auto.master has to have /mnt listed as the key but in the usb autofs config, but I don't know what would need to be listed. I've tried "/" and "." but neither seem to take. I get the following message written to the syslog:

automount[21234]: bad map format: found indirect, expected direct exiting

Does anyone know if this *is* possible and if so, what do I need to put as the key?

Thanks!

Derek

maintainer
#1 lore raw
Quoted 10 lines · Derek Reid

Hi,

I'd like to mount my usb flash drive exclusively on /mnt but I'm not sure if this is possible.

Quoted 1 line

From the docs, it looks like /etc/auto.master has to have /mnt listed as

the key but in the usb autofs config, but I don't know what would need to be listed. I've tried "/" and "." but neither seem to take. I get the following message written to the syslog:

Quoted 5 lines

automount[21234]: bad map format: found indirect, expected direct exiting

Does anyone know if this *is* possible and if so, what do I need to put as the key?

No idea what you mean.
What version of autofs?
How about an example of what you're attempting to do with a description of what you've done and what you've put in what files.

Ian

author
#2 lore raw

Thanks for the reply, Ian.

Here are the details. I need to mount my usb flash drive on /mnt/ . There is no problem mounting it at least two dirs deep (/mnt/foo/ for example) but you can't put "/" as the key in auto.master as "/" is already mounted. Which leaves the other config file (auto.usb in my case). It won't accept "/", which would then indicate "/mnt/", and it errors with the previously mentioned message.

I'm not sure if that helps explain my goal any more clearly but to answer your questions:

* autofs version:

4.1.4 (Fedora Core 5 rpm)

* /etc/auto.master:

  /mnt  /etc/auto.usb --timeout=3 --ghost  

* /etc/auto.usb:

/ -fstype=auto :/dev/sdb1

In short, I suppose I can sum it up in one question: How can you automount something exactly one directory deep from "/"?

Thanks,

Derek

Quoted 25 lines · Ian Kent
Quoted 10 lines · Derek Reid

Hi,

I'd like to mount my usb flash drive exclusively on /mnt but I'm not sure if this is possible.

Quoted 1 line

From the docs, it looks like /etc/auto.master has to have /mnt listed as

the key but in the usb autofs config, but I don't know what would need to be listed. I've tried "/" and "." but neither seem to take. I get the following message written to the syslog:

Quoted 5 lines

automount[21234]: bad map format: found indirect, expected direct exiting

Does anyone know if this *is* possible and if so, what do I need to put as the key?

No idea what you mean.
What version of autofs?
How about an example of what you're attempting to do with a description of what you've done and what you've put in what files.

Ian

maintainer
#3 lore raw
Quoted 18 lines · Derek Reid

Thanks for the reply, Ian.

Here are the details. I need to mount my usb flash drive on /mnt/ . There is no problem mounting it at least two dirs deep (/mnt/foo/ for example) but you can't put "/" as the key in auto.master as "/" is already mounted. Which leaves the other config file (auto.usb in my case). It won't accept "/", which would then indicate "/mnt/", and it errors with the previously mentioned message.

I'm not sure if that helps explain my goal any more clearly but to answer your questions:

* autofs version:

4.1.4 (Fedora Core 5 rpm)

* /etc/auto.master:

Quoted 8 lines
  /mnt  /etc/auto.usb --timeout=3 --ghost  

* /etc/auto.usb:

/ -fstype=auto :/dev/sdb1

In short, I suppose I can sum it up in one question: How can you automount something exactly one directory deep from "/"?

OK, I get it.

The only way to do that (exactly one level) is to use a direct mount map. This will only work with autofs version 5 with a kernel which supports it. Version 5 won't start if the kernel doesn't support it.

In auto.master put

/- /etc/auto.usb --timeout=3

The "--ghost" option isn't needed.

In /etc/auto.usb put

/mnt -fstype=auto :/dev/sdb1

and that should do what you want.

Quoted 31 lines

Thanks,

Derek

Quoted 25 lines · Ian Kent
Quoted 10 lines · Derek Reid

Hi,

I'd like to mount my usb flash drive exclusively on /mnt but I'm not sure if this is possible.

Quoted 1 line

From the docs, it looks like /etc/auto.master has to have /mnt listed as

the key but in the usb autofs config, but I don't know what would need to be listed. I've tried "/" and "." but neither seem to take. I get the following message written to the syslog:

Quoted 5 lines

automount[21234]: bad map format: found indirect, expected direct exiting

Does anyone know if this *is* possible and if so, what do I need to put as the key?

No idea what you mean.
What version of autofs?
How about an example of what you're attempting to do with a description of what you've done and what you've put in what files.

Ian

#4 lore raw
In reply to Derek Reid
Quoted 2 lines · Derek Reid

I'd like to mount my usb flash drive exclusively on /mnt but I'm not sure if this is possible...

Understood that the autofs issue is mounting on an immediate subdirectory of the root, but... The USB drive can be mounted when you first refer to it (using autofs), or when it's hotplugged. This latter way is what mainstream distro integrators are doing. If you're running KDE or Gnome, then gnome-volume-manager should be started. It monitors hotplug messages and should take care of telling haldaemon to mount a newly inserted device or media (on /media/whatever; probably you can influence this mount point choice). But I assume you're using neither Desktop Environment.

I have some notes on gotcha's, including this one. Search for "Gnome" in this document, about halfway through.
http://www.math.ucla.edu/~jimc/documents/bugfix.html
The only thing I haven't figured out is, how do you unmount the USB drive, short of yanking it out while still mounted, which seems like a recipe for disaster. On a CD drive you can press the eject button and the appropriate hot(un)plug message will be sent, but not for USB storage.

Hope this is useful!

James F. Carter Voice 310 825 2897 FAX 310 206 6673
UCLA-Mathnet; 6115 MSA; 405 Hilgard Ave.; Los Angeles, CA, USA 90095-1555
Email: [email protected] http://www.math.ucla.edu/~jimc (q.v. for PGP key)