LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   USB flashdrive automount problem (https://www.linuxquestions.org/questions/slackware-14/usb-flashdrive-automount-problem-270669/)

kaon 12-27-2004 12:35 AM

USB flashdrive automount problem
 
Hi all,

I have done a lot googling and found some ways to automount my lovely USB flashdrive. However, I found that it does not work as I thought.
And I have no idea on locating the problem.

Anyone can help?
Thanks.

Here is my /etc/fstab:

/dev/hda3 swap swap defaults 0 0
/dev/hda2 / reiserfs defaults 1 1
/dev/hda1 /mnt/hda1 vfat defaults,umask=000,iocharset=utf8 0 2
/dev/hdb1 /mnt/hdb1 vfat defaults,umask=000,iocharset=utf8 0 2
/dev/cdrom /mnt/cdrom iso9660 noauto,users,ro 0 0
/dev/fd0 /mnt/floppy auto noauto,users 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
proc /proc proc defaults 0 0
/dev/sda1 /mnt/usb vfat defaults,users,rw 0 0

P.S. my flashdrive will be located in /dev/sda1 everytime I plug it into a USB port.

reddazz 12-27-2004 02:20 AM

mine is mounted as follows,

/dev/sda1 /mnt/flash vfat users 0 0

and it works fine.

gnashley 12-28-2004 10:00 AM

At the time when 'mount -a' is run, hotplug has still not been run so you can't automount at that point in time. I'd put a line to mount it in
/etc/rc.d/rc.local instead.

kaon 01-03-2005 08:35 PM

I faced another problem now. If I do not unmount it explicitly, it leaves the mount point in the filesystem unless using umount.

Is there anyway to fix it so that my USB flashdrive can be plugged in and removed at any time I want without issuing any commands.

Thanks.

WMD 01-04-2005 01:00 AM

Quote:

s there anyway to fix it so that my USB flashdrive can be plugged in and removed at any time I want without issuing any commands.
You can't even do that in Windows!

gnashley 01-04-2005 01:19 AM

The device has to flushed before removal. mount and eject both do this.

Cedrik 01-04-2005 05:04 AM

I use autofs to mount and umount automatically my USB camera (which is seen as USB mass
storage), that works fine.

gnashley 01-04-2005 10:28 AM

Do you mean that you are able to just unplug it without any umount/eject command?

kaon 01-04-2005 10:44 AM

Quote:

Originally posted by gnashley
The device has to flushed before removal. mount and eject both do this.
do you mean I have to explictly issue commands "mount"/"umount" to add/remove my USB flashdrive?

Thanks.

Cedrik 01-04-2005 12:49 PM

Quote:

Do you mean that you are able to just unplug it without any umount/eject command?
yes, I just cd into /misc/mydevice and it is automatically mounted
then when I no longer use it, I cd to my home directory then it is automatically umounted

I wait one second before disconnect it, tough to make sure

gnashley 01-04-2005 01:06 PM

Good to know this.

Cedrik 01-04-2005 01:17 PM

If you use the default kernel, autofs is already compiled (as module) so you just :
installpkg autofs

then copy /usr/doc/autofs-xx.xx.xx/samples/auto* in your /etc, edit /etc/auto.misc to suit your
needs and start /etc/rc.d/rc.autofs

I use a konqueror link as icon in KDE so I just click on it to mount it and show the photos, when
I close the konqueror window, the usb camera is umounted
(I checked that with mount command without argument the first time)

cythrawll 01-04-2005 02:31 PM

if you use the flash drive alot, you could just make bash scripts that mount and unmount, and stick them on your desktop... assuming your using a window manager with desktop icons... but you get the idea.

kaon 01-15-2005 01:23 AM

Quote:

Originally posted by Cedrik
If you use the default kernel, autofs is already compiled (as module) so you just :
installpkg autofs

then copy /usr/doc/autofs-xx.xx.xx/samples/auto* in your /etc, edit /etc/auto.misc to suit your
needs and start /etc/rc.d/rc.autofs

I followed your instructions. And I copied rc.autofs.in into /etc/rc.d/ as there is none.
I rename the file to rc.autofs and chmod its permission with +x flag.
tried to start it.
No luck.

Error message:
tsun@sKex:/etc$ /etc/rc.d/rc.autofs
/etc/rc.d/rc.autofs: Unknown system, please port and contact autofs@linux.kernel.org

One more thing, I issued 'mount' to mount my usb flashdrive and found usbfs in the screen with command 'mount'.
Anything deal with that? (Usbfs, the name looks cool :rolleyes: )

tsun@sKex:~$ mount
/dev/hda2 on / type reiserfs (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
/dev/hda1 on /mnt/hda1 type vfat (rw,umask=000,iocharset=utf8)
/dev/hdb1 on /mnt/hdb1 type vfat (rw,umask=000,iocharset=utf8)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
usbfs on /proc/bus/usb type usbfs (rw)
/dev/sda1 on /mnt/usb type vfat (rw,umask=000)

Thanks.

keefaz 01-15-2005 04:01 AM

When you do :
lsmod

Do you see autofs module loaded ?
Also could you post your /etc/auto.misc file content ?

kaon 01-15-2005 06:58 AM

Quote:

When you do :
lsmod

Do you see autofs module loaded ?
I would say no here. :(

tsun@sKex:/etc/rc.d$ lsmod
Module Size Used by
cisco_ipsec 393868 1
snd_pcm_oss 61220 0
snd_mixer_oss 21120 3 snd_pcm_oss
snd_via82xx 25632 4
snd_ac97_codec 76512 1 snd_via82xx
snd_pcm 99716 4 snd_pcm_oss,snd_via82xx,snd_ac97_codec
snd_page_alloc 9220 2 snd_via82xx,snd_pcm
snd_mpu401_uart 7936 1 snd_via82xx
snd_rawmidi 23456 1 snd_mpu401_uart
nvidia 3463100 8


Quote:

Also could you post your /etc/auto.misc file content ?
Directory of mounting usb drive is located at /mnt/usb.
Here you are:
tsun@sKex:/etc/rc.d$ cat ../auto.misc
# $Id: auto.misc,v 1.2 1997/10/06 21:52:04 hpa Exp $
# This is an automounter map and it has the following format
# key [ -mount-options-separated-by-comma ] location
# Details may be found in the autofs(5) manpage

#kernel -ro ftp.kernel.org:/pub/linux
#boot -fstype=ext2 :/dev/hda1
usb -fstype=vfat :/dev/sda1
#cd -fstype=iso9660,ro :/dev/hdc
#floppy -fstype=auto :/dev/fd0

tsun@sKex:/etc/rc.d$ cat ../auto.master
# $Id: auto.master,v 1.2 1997/10/06 21:52:03 hpa Exp $
# Sample auto.master file
# Format of this file:
# mountpoint map options
# For details of the format look at autofs(8).
/mnt /etc/auto.misc

keefaz 01-15-2005 09:52 AM

Have you the autofs module ?
/sbin/modprobe -l | grep autofs

If yes, it is weird as /etc/rc.d/rc.autofs should load it, anyway try modprobe autofs

Or maybe as built-in, in both case autofs should appear in
cat /proc/filesystems

Jacknight 01-26-2005 10:02 AM

USB automount
 
Does anyone know how Linspire (formerly Lindows) set up their automount? I'm not quite enough of a geek to figure it out. There setup is pretty nice though I plug my pen drive in and it auto mounts and an icon is created for it just like the cdrom. A green arrow is put on top of the icon to indicate it is mounted. When I'm done with it I right click hit unmount the green arrow goes away. Then I can unplug it at which point the icon goes away.

I also like the way that they have the cdrom set up. It automounts like most distros but if I close all windows related to the cd then it auto umounts.

If anyone has any insight into this it is appreciated

JrLz 01-26-2005 08:53 PM

Quote:

Originally posted by WMD
You can't even do that in Windows!
well, at least ...it's one of many great opportunities for GNU/Linux to beat them..............
but how to do the umount automatically ??????????
let's find out.............

DaWallace 01-26-2005 09:25 PM

there's an rc.autofs for slackware

I found it earlier today..

http://mariner.cs.ucdavis.edu/slackw...ware/rc.autofs

google ffs

JrLz 01-27-2005 09:02 PM

Re: USB automount
 
Quote:

Originally posted by Jacknight
Does anyone know how Linspire (formerly Lindows) set up their automount? I'm not quite enough of a geek to figure it out. There setup is pretty nice though I plug my pen drive in and it auto mounts and an icon is created for it just like the cdrom. A green arrow is put on top of the icon to indicate it is mounted. When I'm done with it I right click hit unmount the green arrow goes away. Then I can unplug it at which point the icon goes away.

I also like the way that they have the cdrom set up. It automounts like most distros but if I close all windows related to the cd then it auto umounts.

If anyone has any insight into this it is appreciated

You'll also have it on Suse/Novell and ubuntu......
I've experienced it.......
But I don't have it on my slackware.............
I'll find it out, and I'll post once I get to those machines...

jawkins 01-28-2005 06:49 AM

Quote:

Originally posted by JrLz
well, at least ...it's one of many great opportunities for GNU/Linux to beat them..............
but how to do the umount automatically ??????????
let's find out.............

Automatic umounting when you remove the device would only be possible if you mount the device with the sync and dirsync options to ensure the data is always written to the device immediately. According to my "man mount" sync only works with ext2, ext3 and ufs, so I wouldn't trust it on a USB FAT filesystem. It's also slower and would reduce the lifetime of the flash from unneccessary writes.

Jim

zparihar 02-03-2005 05:07 AM

mtools
 
Hey guys...

I'm actually trying to figure out a similar problem... i've put up a thread about this already...
http://www.linuxquestions.org/questi...hreadid=285696



You do not need to actually mount our unmount the USB key to access files on it...


If you guys have mtools installed... just simply add the following line to your /etc/mtools.conf:

drive u: file="/dev/sdb1" exclusive mformat_only



(sdb or sda - depending on your system)

make sure the permissions on /dev/sdb1 is set to 777

then in Konqueror type in the address ' floppy:/u '

and then you're in your USB Flash....
Do a man mtools to find out more

Simple!

However, my problem is that when i unplug the usb key, my /dev/sdb1 dissappears. (which is ok)
But when i plug in my usb key, the device /dev/sdb1 is recreated with the permissions 700 ! (only root)

Does anyone know a solution on how I can get my permissions to automatically be set to 777 when I plug in my USB Key?


Thanks

Zubin Parihar

zparihar 02-03-2005 04:28 PM

Heres my howto
 
Hey guys...

Here is my howto on how to access your USB Flash Device without mounting and unmounting it!

http://www.linuxquestions.org/questi...hreadid=285916


Hope it helps anyone!


Zubin Parihar


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