Mount situation (in ubuntu)

Place to discuss Debian Linux and Debian based distributions
Post Reply
User avatar
Calum
guru
guru
Posts: 1349
Joined: Fri Jan 10, 2003 11:32 am
Location: Bonny Scotland
Contact:

Mount situation (in ubuntu)

Post by Calum » Fri Mar 30, 2007 12:27 pm

Code: Select all

calum@harvey:~$ cat /etc/fstab
# /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    defaults        0       0

# /dev/hda3 -- converted during upgrade to edgy
UUID=ee374cd2-39ef-453d-aa98-b390ff4c84a5 / ext3 defaults,errors=remount-ro 0 1

# /dev/hda2 -- converted during upgrade to edgy
UUID=812064cf-0513-4196-b7e3-5433484e8c9c /home ext3 defaults 0 2

# /dev/hda1 -- converted during upgrade to edgy
#UUID=00C5-7CFA /winsux vfat quiet 0 0
/dev/hda1 /winsux vfat quiet 0 0

# /dev/hda5 -- converted during upgrade to edgy
UUID=c174d6e9-1dec-4910-a922-faeadb558fb5 none swap sw 0 0

/dev/sda5       /media/usbdisk  auto    rw,users,defaults,sync,umask=0 0 0
/dev/hdc        /media/cdrom0   udf,iso9660 ro,user,noauto  0       0
/dev/fd0        /media/floppy0  auto    rw,user,noauto  0       0
/dev/sda        /media/usb0     auto    rw,user,noauto,sync  0       0
i would like /dev/sda5 to mount automatically on /media/usbdisk
It's a vfat external USB drive, and in my opinion, it should be mounting along with all the other filesystems in fstab, and yet it doesn't. I have gnome installed, but i use fluxbox myself. the easiest way to get /media/usbdisk mounted is to run nautilus and navigate to the drive through "Computer", which appears to mount it fine, but i shouldn't have to do this! any ideas?

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Fri Mar 30, 2007 12:35 pm

My USB sticks mount automatically and they aren't even listed in my /etc/fstab. There are other processes for this. I think we had a similar discussion here in the past. I don't recall a simple answer if it's not just working. I am curious if having it in the /etc/fstab may be one thing that could actually "prevent" it from being automatically mounted.

User avatar
Calum
guru
guru
Posts: 1349
Joined: Fri Jan 10, 2003 11:32 am
Location: Bonny Scotland
Contact:

Post by Calum » Sun Apr 01, 2007 5:17 am

well i only put it in there because it's not mounting!

i don't really remember how else all this is done. to be honest i don't see why anything other than fstab should be needed. It's not a case of reinventing the wheel so much as inventing a semi-automatic ballbearing regulated pneumatic gear shifted travelling foot accessory when a wheel would have done fine.

any ideas where to start looking to fix this? a "real" linux system would be able to do this, so ubuntu should be able to. i have had a bit of a google but sadly found nothing relating to this issue (maybe i am just not looking properly). If i can't fix it, i will have to ditch ubuntu, because i am not prepared to work like this ad infinitum.

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Sun Apr 01, 2007 9:16 am

Here is the thread on this site that I was thinking of that mentions some things that may be involved with the automatic mounting of your device:

http://voidmain.is-a-geek.net/forums/vi ... php?t=1912

To get a thumb drive to automatically mount it's more than just an entry in /etc/fstab. In fact you don't want an entry in the /etc/fstab for a few reasons that I can think of. 1) You are working with a USB device so when inserted it may not come up on the same device (/dev/sda1, /dev/sda2, etc) every time depending on if you have other devices plugged in when you plug that device in. So there has to be a daemon running that will detect when these things are plugged in, create the mount points and automatically mount the device.

On my system when I plug in a thumb drive or a camera or any other USB device that I can mount it will automatically create a mount point under "/media" and mount the device there. In order for this to happen there are several different pieces that work together on this. udev has to be properly configured to start with. The hal daemon is what will actually mount the device when it is inserted. If that is not running it will not get automatically mounted. Have you checked to see if it's running? On Fedora you would "chkconfig haldaemon on" and "service haldaemon start", not sure how it's started on Ubuntu. Finally once the device is mounted you may have some configuration in whatever desktop you are running as to whether or not something else happens after the mount (nautilus comes up in GNOME, etc). I would have thought that Ubuntu had all this configured properly out of the box unless you have some funky USB device. If you can mount it manually I would think hald should be able to detect and mount it automatically.

My suspicion is that your problem lies in the udev/hald area. After plugging the device in check the output of the "dmesg" command and look in /var/log/messages for any hints. When I stick my USB stick in I get this in /var/log/messages:

Code: Select all

Apr  1 10:07:02 laplinux kernel: usb 4-3: new high speed USB device using ehci_hcd and address 2
Apr  1 10:07:02 laplinux kernel: usb 4-3: configuration #1 chosen from 1 choice
Apr  1 10:07:03 laplinux kernel: Initializing USB Mass Storage driver...
Apr  1 10:07:03 laplinux kernel: scsi0 : SCSI emulation for USB Mass Storage devices
Apr  1 10:07:03 laplinux kernel: usbcore: registered new interface driver usb-storage
Apr  1 10:07:03 laplinux kernel: USB Mass Storage support registered.
Apr  1 10:07:08 laplinux kernel: scsi 0:0:0:0: Direct-Access     SanDisk  U3 Cruzer Micro  2.16 PQ: 0 ANSI: 2
Apr  1 10:07:08 laplinux kernel: SCSI device sda: 2006673 512-byte hdwr sectors (1027 MB)
Apr  1 10:07:08 laplinux kernel: sda: Write Protect is off
Apr  1 10:07:08 laplinux kernel: sda: assuming drive cache: write through
Apr  1 10:07:08 laplinux kernel: SCSI device sda: 2006673 512-byte hdwr sectors (1027 MB)
Apr  1 10:07:08 laplinux kernel: sda: Write Protect is off
Apr  1 10:07:08 laplinux kernel: sda: assuming drive cache: write through
Apr  1 10:07:08 laplinux kernel:  sda: sda1
Apr  1 10:07:08 laplinux kernel: sd 0:0:0:0: Attached scsi removable disk sda
Apr  1 10:07:08 laplinux kernel: sd 0:0:0:0: Attached scsi generic sg0 type 0
Apr  1 10:07:08 laplinux hald: mounted /dev/sda1 on behalf of uid 500
Then Nautilus popped up to explore the newly mounted file system. When I selected "unmount" in Nautilus and pulled the stick back out I get this in my /var/log/messages:

Code: Select all

Apr  1 10:10:10 laplinux hald: unmounted /dev/sda1 from '/media/disk-1' on behalf of uid 500
Apr  1 10:10:15 laplinux kernel: usb 4-3: USB disconnect, address 2
When normal local file systems are mounted via the normal fstab/mount method the mount information is entered in /etc/mtab. When something is mounted by the hal daemon the mount information is recorded in /media/.hal-mtab. In both cases the information is removed from the respective files when the file system is unmounted.

User avatar
Calum
guru
guru
Posts: 1349
Joined: Fri Jan 10, 2003 11:32 am
Location: Bonny Scotland
Contact:

Post by Calum » Thu Apr 05, 2007 6:47 am

ok, thanks for that. i will read and take appropriate action as necessary when i get home. i can confirm though that my external hard drive is always /dev/sda5 and i always want it to mount on /media/usbdisk which always exists. It is unlikely that i will be switching the machine on unless this drive is plugged in (though i suppose it could happen). So the usual reasons don't apply to me.

Still, wait till i get home and can pay attention to it.

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Thu Apr 05, 2007 7:59 am

The fstab is good for having things automatically mounted at boot time but it has nothing to do with detecting when something is plugged in while the system is running which is what I thought you were interested in. Is this just an issue where you want it mounted at boot time? If so I apologize for the misundertanding.

User avatar
Calum
guru
guru
Posts: 1349
Joined: Fri Jan 10, 2003 11:32 am
Location: Bonny Scotland
Contact:

Post by Calum » Fri Apr 06, 2007 10:49 am

no need for an apology! when i come here and ask a question you always do your best to answer it!

yes, it's definitely about getting it to mount. i mean /dev/hda5 mounts fine (except it's been changed to some weird hash of characters in the fstab) just as i expect but /dev/sda5 doesn't.

User avatar
Basher52
guru
guru
Posts: 923
Joined: Wed Oct 22, 2003 5:57 am
Location: .SE

Post by Basher52 » Fri Apr 06, 2007 11:04 am

Calum wrote:no need for an apology! when i come here and ask a question you always do your best to answer it!
WORD!!

User avatar
Void Main
Site Admin
Site Admin
Posts: 5716
Joined: Wed Jan 08, 2003 5:24 am
Location: Tuxville, USA
Contact:

Post by Void Main » Fri Apr 06, 2007 11:50 am

Calum wrote:no need for an apology! when i come here and ask a question you always do your best to answer it!

yes, it's definitely about getting it to mount. i mean /dev/hda5 mounts fine (except it's been changed to some weird hash of characters in the fstab) just as i expect but /dev/sda5 doesn't.
Take the "noauto" option out of your fstab entry and your drive should mount at boot. Also, I see in your fstab entry you refer to the "/dev/sda" device and in your last message you refer to it as "/dev/sda5". I suspect the actual file system you want to mount is "/dev/sda5", just make sure the first entry on the fstab line is set to that and not sda. By using the "noauto" option you are specifically telling your system not to mount the device at boot time. I would also create a directory somewhere other than under /media to mount it when you mount it at boot. The /media directory is more for hot plugged devices but there may not be any technical reasons you can't mount things there.

User avatar
Calum
guru
guru
Posts: 1349
Joined: Fri Jan 10, 2003 11:32 am
Location: Bonny Scotland
Contact:

Post by Calum » Tue Apr 10, 2007 4:11 am

i am so dumb! i should have been able to spot those things myself!

thanks void main.

re: using /media, i would have preferred to use /mnt for everything but it seems that all the modern linuces have sneaked all the optical drives into /media (which i think is pretty messy) so i thought, well, why try to beat 'em when i can just join 'em?

EDIT: see the final line there, that was some ubuntu thing that put that there you know, not me. It may be an ubuntu attempt to use one of my usb pen drives, i suppose i'm unlikely to use them again now i have this usb drive.

JoeDude
administrator
administrator
Posts: 355
Joined: Sun Feb 08, 2004 1:41 pm
Location: Sutton Coldfield, UK
Contact:

Post by JoeDude » Tue Apr 10, 2007 7:24 am

Not entirely unrelated....

I had to reinstall the automount (can't remember wht the name of it was) to get my bluetooth dongle to work properly through usb. Since I did that, all I have to do is plug it in and away it goes.

Post Reply