LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-24-2006, 09:18 AM   #1
cnm
Member
 
Registered: Nov 2006
Distribution: RHEL 4
Posts: 34

Rep: Reputation: 15
How to change /etc/auto.master to mount USB


How to change /etc/auto.master to automatically mount USB pen drive soon after connecting to USB.

Last edited by cnm; 11-24-2006 at 10:50 PM.
 
Old 11-25-2006, 01:55 AM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671
The auto.master file has its own manpage: man 5 auto.master.
 
Old 11-25-2006, 02:08 AM   #3
cnm
Member
 
Registered: Nov 2006
Distribution: RHEL 4
Posts: 34

Original Poster
Rep: Reputation: 15
I found a way. Tell me if there is another better way to do it.

Add the following line to /etc/auto.master (can use "vi")

/anyDirectory/anySubDirectory /etc/auto.anyname

*above "/anyDirectory/anySubDirectory" should be created.(can use "mkdir")
And add the following line to /etc/auto.anyname (you may have to create this file)

anyNameForDevice -fstype=vfat,rw :/dev/sda1


then restart autofs (can use "service autofs restart")

USB will be mounted to "/anyDirectory/anySubDirectory/anyNameForDevice" directory automatically when its pluged. this sub directory anyNameForDevice exsists only when the USB is pluged.
 
Old 11-25-2006, 02:12 AM   #4
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671
One thing to check is if your distro uses udev rather than autofs. Try "ps -u root | grep udev" and "sudo /sbin/chkconfig autofs".
 
Old 11-25-2006, 04:23 PM   #5
AdaHacker
Member
 
Registered: Oct 2001
Location: Brockport, NY
Distribution: Kubuntu
Posts: 384

Rep: Reputation: 31
Quote:
Originally Posted by cnm
USB will be mounted to "/anyDirectory/anySubDirectory/anyNameForDevice" directory automatically when its pluged.
Actually, no, that's not how autofs works. The device will be mounted when you access the mount point, not when you plug it in. Autofs mounts filesystems on demand and then automatically unmounts them after a certain period of inactivity. It doesn't know about USB hotplug events and will not respond to them. For your purposes, the difference is probably academic, but it is there.

Quote:
Originally Posted by jschiwal
One thing to check is if your distro uses udev rather than autofs.
That statement makes no sense. Udev handles dynamic creation and destruction of device nodes and is installed on every reasonably up-to-date Linux system. Autofs handles mounting local and network filesystems. One is not a substitute for the other.
 
Old 11-26-2006, 06:42 AM   #6
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671
I should have said udev and subfs.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto-mount USB device satimis Linux - General 1 10-07-2006 11:37 PM
auto mount usb drive jag Slackware 3 07-28-2006 03:09 AM
how to auto-mount usb storage mirto Slackware 7 01-05-2006 10:48 AM
autofs enabled in kernel but auto.mount and auto.master are NOT in /etc! Alybyzrp Linux - General 0 11-11-2003 12:26 PM
Auto Mount Floppy/CD/USB Asificare Red Hat 2 08-29-2003 09:53 AM


All times are GMT -5. The time now is 08:13 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration