LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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 12-03-2008, 03:45 PM   #1
TweeKane
LQ Newbie
 
Registered: Dec 2008
Location: Russia, Saint Petersburg
Distribution: Arch GNU/Linux
Posts: 6

Rep: Reputation: 0
Auto-mount usb flash without any DE


I tried two ways:
  1. /etc/udev/rules.d/00.my.rules
    Code:
    ATTRS{model}=="USB MP3		 ", NAME="explay"
    /etc/auto.master
    Code:
    /var/autofs/explay	  /etc/auto.misc -timeout=2
    /etc/auto.misc
    Code:
    explay		  -fstype=vfat,users,rw,umask=0002,codepage=866,iocharset=utf8,gid=users,sync	 :/dev/explay
  2. /etc/udev/rules.d/00.my.rules
    Code:
    ATTRS{model}=="USB MP3		 ", NAME="explay", RUN+="/bin/mount -t auto /dev/explay"
    /etc/fstab
    Code:
    /dev/explay	 /media/explay   vfat users,rw,umask=0002,codepage=866,iocharset=utf8,gid=users,sync 0 0

After connecting my usb flash, it appears in /dev as /dev/explay but it's not mounts automaticly, nevertheless i can mount it manualy.

I'm using Debian Lenny.
 
Old 12-03-2008, 04:58 PM   #2
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,897

Rep: Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322
Make sure that automount is running:
Code:
ps -ef|grepa automount
Note also that you should create the /var/autofs directory, while the /var/autofs/explay is created automatically when you connect the flash drive. So connect the flash drive in the usb port and the run
Code:
ls /var/autofs/explay
to see if it's mounted automatically by listing its contents.
If this is not working running dmesg could show you what's wrong.

Regards
 
Old 12-04-2008, 04:30 AM   #3
TweeKane
LQ Newbie
 
Registered: Dec 2008
Location: Russia, Saint Petersburg
Distribution: Arch GNU/Linux
Posts: 6

Original Poster
Rep: Reputation: 0
Autofs works:
Code:
$ sudo /etc/init.d/autofs status
Configured Mount Points:
------------------------
/usr/sbin/automount --timeout=300 /var/autofs/explay file /etc/auto.misc
/usr/sbin/automount --timeout=300 /var/autofs/flash file /etc/auto.misc

Active Mount Points:
--------------------
/usr/sbin/automount --pid-file=/var/run/autofs/_var_autofs_explay.pid --timeout=300 /var/autofs/explay file /etc/auto.misc
/usr/sbin/automount --pid-file=/var/run/autofs/_var_autofs_flash.pid --timeout=300 /var/autofs/flash file /etc/auto.misc
Code:
$ ps -ef|grep automount
root      2386     1  0 13:04 ?        00:00:00 /usr/sbin/automount --pid-file=/var/run/autofs/_var_autofs_explay.pid --timeout=300 /var/autofs/explay file /etc/auto.misc
root      2428     1  0 13:04 ?        00:00:00 /usr/sbin/automount --pid-file=/var/run/autofs/_var_autofs_flash.pid --timeout=300 /var/autofs/flash file /etc/auto.misc
sergey    3074  2884  0 13:10 pts/1    00:00:00 grep automount
Device created:
Code:
$ ls /dev/flash
/dev/flash
Code:
$ sudo mount | grep flash
automount(pid2428) on /var/autofs/flash type autofs (rw,fd=4,pgrp=2428,minproto=2,maxproto=4)
But where is no files in /var/autofs/flash/ directory:
Code:
$ sudo ls -l /var/autofs/flash/
итого 0
And it's not mounted:
Code:
$ sudo umount /dev/flash
umount: /dev/flash: not mounted

But i can mount my flash manualy:
Code:
 $ sudo mount -t vfat /dev/flash /mnt/flash/
$ ls /mnt/flash/
casper  isolinux  ldlinux.sys  md5sum.txt  preseed  syslinux.cfg  ubnfilel.txt  ubninit  ubnkern  ubnpathl.txt  vesamenu.c32
I'm not understand why it is happening
 
Old 12-04-2008, 06:26 AM   #4
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,897

Rep: Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322
According to /etc/auto.misc your usb stick it's automounted on /var/autofs/explay and not on /var/autofs/flash. Now you have to edit /etc/auto.master like this:
Code:
/var/autofs   /etc/auto.misc
If you want to use the timeout option you should add "--timeout=2" (note there are 2 dashes in front) to the above line.

Last edited by bathory; 12-04-2008 at 07:08 AM.
 
Old 12-04-2008, 06:52 AM   #5
TweeKane
LQ Newbie
 
Registered: Dec 2008
Location: Russia, Saint Petersburg
Distribution: Arch GNU/Linux
Posts: 6

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by bathory View Post
According to /etc/auto.misc your usb stick it's automounted on /var/autofs/explay and not on /var/autofs/flash.
This is just another flash stick, it has it's own strings in config files

Quote:
Originally Posted by bathory View Post
Code:
/var/autofs   /etc/auto.misc
If you want to use the timeout option you should add "--timeout=2" (note there are 2 dashes in front) to the above line.
There is no such file in my /etc catalog, i create it manualy. And nothing happens after plug-in my device…
 
Old 12-04-2008, 07:14 AM   #6
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,897

Rep: Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322
Quote:
There is no such file in my /etc catalog, i create it manualy. And nothing happens after plug-in my device…
Ok, this is my fault. I've forgotten the dot in the filename. The correct is /etc/auto.master. You should have something like the following:
/etc/auto.master
Code:
/var/autofs   /etc/auto.misc
/etc/auto.misc
Code:
explay		  -fstype=vfat,users,rw,umask=0002,codepage=866,iocharset=utf8,gid=users,sync	 :/dev/explay
You can connect the usb device in the computer and watch the dmesg output to find the correct device name (in my system the usb stick is /dev/sda1) and replace explay with it in /etc/auto.misc.
Of course you need to restart autofs.

Last edited by bathory; 12-04-2008 at 07:15 AM.
 
Old 12-04-2008, 08:38 AM   #7
TweeKane
LQ Newbie
 
Registered: Dec 2008
Location: Russia, Saint Petersburg
Distribution: Arch GNU/Linux
Posts: 6

Original Poster
Rep: Reputation: 0
Oh... I remove all lines from udev config… According dmesg outputs, my flash name is /dev/sda1
I have only one string in /etc/auto.master:
Code:
/var/autofs/    /etc/auto.misc --timeout=2
And only one string in /etc/auto.misc:
Code:
explay           -fstype=vfat,users,rw,umask=0002,codepage=866,iocharset=utf8,gid=users,sync     :/dev/sda1
And it works. Thank you very much

And one more question: need i use "sync" mounting option with "--timeout=2" at my /etc/auto.master file? I think that "synk" makes writing slower…
 
Old 12-04-2008, 09:41 AM   #8
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,897

Rep: Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322Reputation: 1322
Glad to see it worked.
You don't need the sync option with such a short timeout.

Regards
 
Old 12-04-2008, 10:22 AM   #9
TweeKane
LQ Newbie
 
Registered: Dec 2008
Location: Russia, Saint Petersburg
Distribution: Arch GNU/Linux
Posts: 6

Original Poster
Rep: Reputation: 0
Thumbs up

Thanks a lot
 
  


Reply

Tags
automount, debian, udev


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-Mounting USB Flash Drive plehman Linux - Newbie 12 01-05-2009 09:41 AM
auto mounting usb flash drive lumak Slackware 4 11-30-2008 11:37 PM
SuSE 9.3 USB Flash Drive Auto Mount Stopped Working nuro305 Linux - Hardware 11 04-15-2007 05:21 AM
how come usb flash drive doesn't get auto mounted? darkhatter Fedora 5 02-26-2006 08:04 PM
when i mount my USB Flash Drive A Messenge has come that mount: can't find /dev/sda/h feda82 Red Hat 2 12-24-2005 02:15 AM


All times are GMT -5. The time now is 06:10 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration