LinuxQuestions.org
Visit Jeremy's Blog.
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 07-08-2003, 07:05 AM   #1
plehman
LQ Newbie
 
Registered: Jul 2003
Location: Durham, NC
Distribution: Fedora Core 2
Posts: 23

Rep: Reputation: 15
Auto-Mounting USB Flash Drive


Hi all,

I still really, really new to Linux, but was able to get RH9 installed on my home and laptop machines without too many issues. I frequently bring large files home from work on a USB FLASH memory drive (Lexar 64MB JumpDrive), and wanted to be able to use it in Linux as well (in hopes of oneday dropping windows entirely).

Using bits and pieces from posts on other similar topics from this website as well as a couple of man pages, I have figured out (using dmesg) that my FLASH drive is assigned as a SCSI device /dev/sda1, and I have figured out how to mount and unmount my USB Flash Drive by adding the following line to /etc/fstab

/dev/sda1 /mnt/flash vfat noauto,user 0 0

and the following line to /etc/auto.misc

flash -fstype=vfat :/dev/sda1

As I understant it, adding the line to /etc/fstab lets me say 'mount /dev/sda1' as either a user or as root. The 'noauto' feature simply implies that RH9 will not look for it on bootup.

I added the line to /etc/auto.misc following a cd-rom example so that when I mounted it, GNOME would add an icon to the desktop for that mount point. This seems to work.

What my question is then, is how can I make it automatically detect when I have inserted the USB device, and mount it by itself so that I don't have to go to a terminal and mount it manually? I assume this is possible, because what I want to do seems to work for cds (i.e. when I put data cds into the cd drive, the icon automatically pops up).

Any help would be greatly appreciated.
 
Old 07-08-2003, 04:39 PM   #2
Electro
Guru
 
Registered: Jan 2002
Posts: 6,042

Rep: Reputation: Disabled
Look in to hotplug. It should be installed in your computer. Also you can try supermount but it can be glitchy sometimes.

http://linux-hotplug.sourceforge.net/
 
Old 07-08-2003, 06:51 PM   #3
plehman
LQ Newbie
 
Registered: Jul 2003
Location: Durham, NC
Distribution: Fedora Core 2
Posts: 23

Original Poster
Rep: Reputation: 15
Electro-

Thanks so much for the suggestion. It sounds like this is what I am looking for.

If I understood it correctly, typing '/sbin/hotplug usb' should set it up. I tried that and it doesn't seem to work like I thought it would. I will have to keep investigating.

Thanks again.
 
Old 07-08-2003, 07:21 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,978
Blog Entries: 11

Rep: Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879
I'm quite happily using murasaki
and it's ancestor usbmgr (on older installations)
for this task ...

Cheers,
Tink

Last edited by Tinkster; 07-08-2003 at 07:23 PM.
 
Old 06-07-2006, 03:38 AM   #5
DarkstarNZ
LQ Newbie
 
Registered: Jun 2006
Location: Wellington, New Zealand
Distribution: Slackware
Posts: 7

Rep: Reputation: 0
Annoying? .... certainly

Hi there

Having just upgraded to the new kernel (2.6.16.20) I am trying to get the USB drives to mount under dropline gnome. What a pain! As far as I can tell, all the modules are compiled correctly in the kernel, and the HALD daemon starts at boot, but no way to mount any usb drives.
Now Slackware is a great distro, but this is so annoying.

I've read all the feeds on several fora, but there is nothing decisive. My biggest pain is that I am getting the dreaded /dev/sda is not a valid block device message.
fdisk will not find /dev/sda
can't mount /dev/sda

Sorry there is no dmesg post, but the linux box is off the net at the moment, but the bus is found by the kernel, itis justthe disc mounting that is not happeneing.

In fstab I have

/dev/sda /mnt/usbdrive vfat rw, noauto, user 0 0


Any ideas, however vague would be great.

At least the G5 is working properly!
 
Old 06-07-2006, 10:18 AM   #6
zborgerd
Member
 
Registered: Mar 2004
Distribution: Slackware / Dropline GNOME
Posts: 378

Rep: Reputation: 30
Quote:
Originally Posted by DarkstarNZ
Hi there

Having just upgraded to the new kernel (2.6.16.20) I am trying to get the USB drives to mount under dropline gnome. What a pain! As far as I can tell, all the modules are compiled correctly in the kernel, and the HALD daemon starts at boot, but no way to mount any usb drives.
Now Slackware is a great distro, but this is so annoying.

I've read all the feeds on several fora, but there is nothing decisive. My biggest pain is that I am getting the dreaded /dev/sda is not a valid block device message.
fdisk will not find /dev/sda
can't mount /dev/sda

Sorry there is no dmesg post, but the linux box is off the net at the moment, but the bus is found by the kernel, itis justthe disc mounting that is not happeneing.

In fstab I have

/dev/sda /mnt/usbdrive vfat rw, noauto, user 0 0


Any ideas, however vague would be great.

At least the G5 is working properly!
HAL requires that you don't have fstab entries for your usb drive. Remove these fstab entries (or comment them out) and it should mount just fine, provided your kernel is compiled properly.

You should post these questions in the dropline forums, or search there if you have any further concerns.
 
Old 01-03-2009, 10:50 PM   #7
DragonM15
Member
 
Registered: Sep 2003
Location: USA
Distribution: Slackware (Multiple Versions)
Posts: 455

Rep: Reputation: 31
Quote:
Originally Posted by zborgerd View Post
HAL requires that you don't have fstab entries for your usb drive. Remove these fstab entries (or comment them out) and it should mount just fine, provided your kernel is compiled properly.

You should post these questions in the dropline forums, or search there if you have any further concerns.
I was under the impression that HAL honors your fstab entries. With this in mind, I thought HAL would mount your devices like usb drives where fstab has that device listed. Or am I incorrect in my thoughts?

DragonM15
 
Old 01-03-2009, 11:19 PM   #8
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
Quote:
I was under the impression that HAL honors your fstab entries
I think it varies between distros. Monitor the kernel messages just before inserting a pendrive: "sudo tail -f /var/log/messages". There may be a message saying something like: HAL refuses to mount drive because it has an fstab entry. Part of it may be the desktop as well. HAL and the desktop environment communicate via the dbus. If hald, dbusd or udevd aren't running, automounting won't work. One thing that can keep these services from running is if you use the "noacpi" kernel boot option (in your /boot/grub/menu.lst kernel entry).

On SuSE an fstab entry will keep HAL from automounting the disk. An entry in fstab is taken as a desire to mount it yourself. Especially if you mount it under /mnt, because HAL only mounts drives under /media/.
Also, check the hidden /media/.hal_mtab file for a stale entry.

SuSE has a nice helper program called "halmount". Check if yours does as well. Entering /dev/sda1 or /media/<label> will mount the drive. Entering "halmount" by itself will print out information on devices that hal sees.

By the way, are you certain that the drive is /dev/sda1? That is usually the first partition on the first harddrive.

Last edited by jschiwal; 01-03-2009 at 11:21 PM.
 
Old 01-03-2009, 11:39 PM   #9
AwesomeMachine
Senior Member
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian jessie/sid; OpenSuSE; Fedora
Posts: 1,593

Rep: Reputation: 162Reputation: 162
No spaces after commas ...

Quote:
Originally Posted by DarkstarNZ View Post
In fstab I have

/dev/sda /mnt/usbdrive vfat rw, noauto, user 0 0


Any ideas, however vague would be great.
No spaces after commas in the mount options.
 
Old 01-03-2009, 11:45 PM   #10
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
I just noticed that you are using /dv/sda instead of /dev/sda1. That may be a mistake.

Some pendrives are formatted like floppies and don't have a partition table, but most do.

Look at "udevinfo -q env -n /dev/sda" and "udevinfo -q env -n /dev/sda1". Which one mentions the filesystem on the pendrive.
Also look in your kernel messages. Does it mention a /dev/sda1 device? And yes, there shouldn't be commas between options.

And please, double check that /dev/sda is the pendrive device and not your hard drive.

First, comment out the /etc/fstab entry and see if automounting works. HAL definitely won't automount a drive on /mnt.

Last edited by jschiwal; 01-03-2009 at 11:46 PM.
 
Old 01-03-2009, 11:55 PM   #11
Hitboxx
Senior Member
 
Registered: Mar 2006
Location: India
Distribution: Fedora
Posts: 1,562
Blog Entries: 3

Rep: Reputation: 51
Anybody bothered to look at the date?

Reported!
 
Old 01-05-2009, 09:39 AM   #12
DragonM15
Member
 
Registered: Sep 2003
Location: USA
Distribution: Slackware (Multiple Versions)
Posts: 455

Rep: Reputation: 31
Quote:
Originally Posted by jschiwal View Post
By the way, are you certain that the drive is /dev/sda1? That is usually the first partition on the first harddrive.
On my old laptop the hard drive is shown as hda[#], and usb or other devices are shown as sda[#]. Also, if DMA is not cooperating on my new laptop, its hard drive is shown as hda, but if I get the proper kernel configuration, then they are shown as sda. I suppose it depends on exactly what hardware and kernel config you have.
 
Old 01-05-2009, 09:41 AM   #13
DragonM15
Member
 
Registered: Sep 2003
Location: USA
Distribution: Slackware (Multiple Versions)
Posts: 455

Rep: Reputation: 31
Quote:
Originally Posted by Hitboxx View Post
Anybody bothered to look at the date?

Reported!
HA! Isnt that funny.... yeah... I just found this post when I was browsing through google looking for a hal related error. Didn't even think to look at the date. Oh well, I guess we brought an older post to the top.

Last edited by DragonM15; 01-13-2009 at 02:34 PM.
 
  


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
Problem mounting usb flash drive with 2.6.12.2 kernel dcdbutler Slackware 16 09-12-2005 07:48 PM
USB flash drive mounting problem guillaume31 Linux - Hardware 4 05-23-2005 11:47 AM
USB Flash Drive not Mounting Kentara Linux - Hardware 1 03-12-2005 08:59 AM
Mounting a USB Flash Drive Garibaldi3489 Slackware 3 01-04-2005 09:09 PM
Trouble mounting usb flash drive alpha1906 Slackware 6 08-20-2004 02:59 PM


All times are GMT -5. The time now is 07:16 AM.

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