LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (http://www.linuxquestions.org/questions/debian-26/)
-   -   How to mount usb stick (http://www.linuxquestions.org/questions/debian-26/how-to-mount-usb-stick-255953/)

yotamk 11-17-2004 08:25 AM

How to mount usb stick
 
On Debian sarge, kernel 2.6.8 with hotplug,

how do I mount my usb?
Is it automatically mounted and where?
If not, is there a way for me to have it automatically mounted?

I need access to my usb stick (disc-on-key) badly :(

Thanks.

otoomet 11-17-2004 10:16 AM

Hi,

1) make sure you have a line like

/dev/sda1 /mnt/usb vfat noauto,user,fmask=133,dmask=022 0 0

in your /etc/fstab.

2) mount it:

$ mount /mnt/usb

3) If it is not formatted, use

# fdisk /dev/hda

delete what is there before and make a new partition. Format it

# mkfs -t vfat /dev/hda1

(I am not completely sure about command syntax, check it).

best,

Ott

yotamk 11-17-2004 02:10 PM

Thanks :)

yotamk 11-18-2004 05:37 AM

OK, I can now mount usb successfully, but how do I get it to auto-detect my disc-on-key and mount it automatically when plugged in?

in fstab I've changed noauto to auto in the usb line, but this doesn't seems to do the trick...

Optimistic 11-18-2004 11:01 AM

Quote:

Originally posted by yotamk
OK, I can now mount usb successfully, but how do I get it to auto-detect my disc-on-key and mount it automatically when plugged in?

in fstab I've changed noauto to auto in the usb line, but this doesn't seems to do the trick...

If you changed fstab, then it should do the trick, but in order for fstab settings to take effect you have to restart the computer.

My fstab looks like this:
/dev/sda1 /mnt/usb auto rw,user,noauto 0 0

and the stick gets mounted when I open the /mnt/usb folder (just like a floppy).


You probably don't want to change the noauto to auto, because that will try to mount on boot (I think)--you don't want that. Just put a line like mine or the other one above and the stick will mount when you open the folder.

I'm I'm using Fluxbox and Rox-filer on Debian Sarge with 2.6.8, so this might make some difference.

Dead Parrot 11-19-2004 11:51 AM

Quote:

My fstab looks like this:
/dev/sda1 /mnt/usb auto rw,user,noauto 0 0

and the stick gets mounted when I open the /mnt/usb folder (just like a floppy).
I haven't used Rox-filer but it's a neat trick if it can mount filesystems when accessing folders that are mentioned in fstab. However, as I see it, the problem is not as much in the mounting of devices as it is in unmounting them. You see, the Linux kernel doesn't necessarily write changes immediately when you move files between hard disk and removable media, so if you remove your floppy or usb-stick before properly unmounting them you may lose data.

Personally I'm not into automounting. I've installed xvmount and assigned an appicon (that is, a quick launch icon) for it in WindowMaker. (xvmount is a GUI tool that allows you to mount devices mentioned in fstab with one click and unmount them with another click.) Now, whenever I need to access a cdrom, floppy, or usb-stick, I launch xvmount and click on the xvmount button for the device I wish to mount. Then I leave xvmount open in the background so that I can tell with just one look if there are any unmounted devices. With automount systems you can never be sure if they work as expected but using xvmount I can make sure that all data has been transferred before I remove cdrom/floppy/usb-stick.

An alternative way would be to use MToolsFM (provided you use vfat formatted floppies/usb-sticks), as I describe in this thread: http://www.linuxquestions.org/questi...hreadid=250852
Using MToolsFM you don't need to mount devices and, hence, there's no fear of losing data when you remove floppy or usb-stick.

yotamk 11-21-2004 12:46 AM

Thanks, I'll check it...


All times are GMT -5. The time now is 11:26 AM.