in reply to Opening a USB drive for storing info.

It's entirely possible that I'm way off on this, and it's sort of a Ubuntu/Linux topic as opposed to Perl but here goes my stab at helping you along...

It seems to me that USB drives are demand-mounted by Ubuntu's desktop environment (the Gnome / Unity environment), and not fstab settings. My experience has been that the drives don't get mounted until I literally click on them from the Unity desktop. They do exist, however, in /dev/*, and as such, you can mount them manually, or even create an fstab entry.

It's possible your script needs to mount the drive for you rather than waiting for Gnome/Unity to get around to it.

If the USB drive uses a FAT based filesystem, you may need to mount with cifs as well.

Again, this is based on limited experience; I haven't fiddled more than a few minutes with plugging USB drives into my Ubuntu box, and that was not recently either. But to the best of my recollection, those were obstacles I discovered, and either using the GUI to demand-mount the drive, or manually mounting it were the solutions I used.

I don't really like having things mounted in /media anyway. It just doesn't feel linux-ish. But that's personal preference, and the good thing about mounting it yourself manually is you get to follow your own whim. I put them in /mnt/*. My NAS is set up to mount in /mnt/lsxhl (Linkstation XHL), for example.

Update: The following link discusses setting up auto-mount, as well as manually mounting USB drives. It does look like automounting of USB drives is controlled by nautilus. https://help.ubuntu.com/community/Mount/USB


Dave

  • Comment on Re: Opening a USB drive for storing info.

Replies are listed 'Best First'.
Re^2: Opening a USB drive for storing info.
by afoken (Chancellor) on May 23, 2011 at 09:15 UTC
    If the USB drive uses a FAT based filesystem, you may need to mount with cifs as well.

    Nope, CIFS is the modern replacement for SMB; both are used only to connect to Windows and Samba shares. It is a network file system like NFS and others, and it has no relation with FAT file systems except that a Windows or Samba server can share drives or folders on a drive formatted with a FAT filesystem.

    Most USB sticks come preformatted with VFAT-32. Using a mount command without an explicit filesystem option (-t) auto-detects that on any recent Linux distribution. Note that you may need root privileges to mount filesystems not listed in /etc/fstab.

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

      Ah, you're right... I was thinking of my Buffalo Linkstation Live NAS LS-XHL, with respect to CIFS. The other advice seems to be relatively on-track. ;)


      Dave

Re^2: Opening a USB drive for storing info.
by Steve_BZ (Chaplain) on May 23, 2011 at 14:17 UTC

    Hi Davido,

    You are absolutely right. This is the problem. It seems there is some general confusion out there regarding automount. I can pre-set automount for devices I know I am going to use, but setting it generally 'on' for unknown devices is eluding me. I'm on Kubuntu 10.4, and the various forums have plenty of advice on the subject which I'm working through.

    Thanks for pointing me in the right direction.

    Regards

    Steve