LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 08-24-2008, 02:52 AM   #1
checkmate3001
Member
 
Registered: Sep 2007
Location: Folsom, California
Distribution: Ubuntu, Mint, Debian, Suse
Posts: 307

Rep: Reputation: 32
automount usb mass storage


Hello peeps,

I've got a debian 4 (etch) system with kde. Every time I stick in a usb flashdrive it auto-mounts and asks if I want to open it or not. I have no problems with it.

However, I want to change the way it mounts so that I can use the uuid of the flash drive to assign it a static mount point (ie: always mount flashdrive with uuid=7586-3937 to /media/flashdrive1). I haven't gotten the chance to see what happens if I insert two flashdrives at once... but I think it would be random which flashdrive would mount where.

My question is: where does all this magic happen? I have no mentions of the flashdrive in my fstab. I've tried putting a line including the uuid and mount point in my fstab which leads to permission problems when I try to mount it. Another thing I find strange is that the current mount point for the flashdrive gets created on the fly when I insert the flashdrive. /media/disk does not exist when the usb flashdrive is not mounted - but it does exist when it is mounted. I always thought the directory had to exist before the usb flashdrive was mounted.

Can anyone point me in the direction of where to find where all this magic happens so I can poke around and try to configure it to my liking?

Thanks
 
Old 08-24-2008, 05:29 AM   #2
makuyl
Senior Member
 
Registered: Dec 2004
Location: Helsinki
Distribution: Debian Sid
Posts: 1,107

Rep: Reputation: 54
This is one possibility:
plug in stick
"dmesg" look for the device, let's say it's sdc:sdc1
"udevinfo -a -p `udevinfo -q path -n /dev/sdc` | grep serial" #get the serial, for me: ATTRS{serial}=="0602101948231"
add to the top of /etc/udev/rules.d/60-persistent-storage.rules the following line:
BUS=="usb", KERNEL=="sd?1", SYSFS{serial}=="0602101948231", NAME="kingston", SYMLINK="kingston%n"
use any name, I have kingston there
add to /etc/fstab the following line:
/dev/kingston1 /media/kingston vfat noauto,users,exec,noatime,umask=000 0 0
make a dir under media:
drwxrwx--- 2 root users 4096 2008-08-24 13:15 kingston

Plenty more on google for usb and udev.

Edit: You might have to do "/etc/init.d/udev restart" before it works, can't remember.

Last edited by makuyl; 08-24-2008 at 05:54 AM. Reason: Added command
 
1 members found this post helpful.
Old 08-24-2008, 10:10 AM   #3
specialized
Member
 
Registered: Sep 2005
Location: Mar del Plata, Arg
Distribution: Always Slackware
Posts: 228

Rep: Reputation: 37
udevrules dont look in the fstab file
Do a good udev rule and works fine
and remember to add the user to plugdev and messagebus.

bye
 
Old 08-24-2008, 11:27 AM   #4
makuyl
Senior Member
 
Registered: Dec 2004
Location: Helsinki
Distribution: Debian Sid
Posts: 1,107

Rep: Reputation: 54
No. You can set permissions for mounting in fstab like above, but yes, you could also set them in the rule.
 
Old 08-24-2008, 01:02 PM   #5
checkmate3001
Member
 
Registered: Sep 2007
Location: Folsom, California
Distribution: Ubuntu, Mint, Debian, Suse
Posts: 307

Original Poster
Rep: Reputation: 32
Thank you guys. I found the udev stuff earlier, but I was scared - it looked deep and important. I will read a little about it and give it a try. I didn't know that was where it all happend. Good to know.

Thanks again.
 
Old 08-25-2008, 03:49 AM   #6
checkmate3001
Member
 
Registered: Sep 2007
Location: Folsom, California
Distribution: Ubuntu, Mint, Debian, Suse
Posts: 307

Original Poster
Rep: Reputation: 32
Worked like a charm. Now it always mounts where I want it. Fantastic. Makes it easier to write a backup script or something... haven't really done anything yet. But I'm happy.
 
1 members found this post helpful.
  


Reply

Tags
automount, debian, fstab, udev, usb, uuid



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
How to disable USB Mass Storage device ( usb drive ) in Linux vijaush Linux - Newbie 4 06-25-2008 09:43 AM
After plug in apacer ht202 usb mass storage into usb port. Nothing appear. tellmeimhong Linux - Hardware 3 02-04-2006 02:32 AM
USB Mass storage. vexer Linux - Software 2 09-05-2004 09:00 PM
Automount CD / DVD/ USB Mass Storage grim1234 Linux - Software 1 08-20-2004 05:04 AM
USB Mass Storage Zebee Linux - Hardware 2 08-03-2003 08:17 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 08:29 PM.

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
Open Source Consulting | Domain Registration