Results 1 to 3 of 3

Thread: Mounting Flash Drives, How-To

  1. #1
    Associate
    Join Date
    Jun 2005
    Posts
    27

    Mounting Flash Drives, How-To

    Alrighty This is my first posting so if there is any corrections staff, feel free to edit my post alright?

    Ok one thing I notice is most people new to linux, who have been on windows for most of their life, have a neat little thing called a Flash drive, and these drives they use quite offen, so I thought to create a niffty little way to check for support and mount them, since certain distros (Debian, i know for a fact wants you to mount it as ubb1 etc instead of sdc or sdd or sde like fedora and most distros do)

    Alright first, most Flash drives are formatted using vfat, now you must have support in your kernel or have a module loaded for vfat support, to check you type in lsmod or in Fedora /sbin/lsmod for those who have the path variable not include /sbin for security reasons.

    here is the results of my lsmod

    [stephan@localhost bin]$ /sbin/lsmod
    Module Size Used by
    autofs4 22725 2
    ipt_REJECT 9665 1
    ipt_state 5825 1
    ip_conntrack 46377 1 ipt_state
    iptable_filter 6849 1
    ip_tables 24897 3 ipt_REJECT,ipt_state,iptable_filter
    dm_mod 59749 0
    video 19909 0
    button 10577 0
    battery 13381 0
    ac 8773 0
    usb_storage 74761 0
    md5 8001 1
    ipv6 265857 8
    ohci1394 39177 0
    ieee1394 302873 1 ohci1394
    uhci_hcd 35409 0
    ehci_hcd 38093 0
    shpchp 96965 0
    hw_random 9557 0
    i2c_i801 12621 0
    i2c_core 25409 1 i2c_i801
    snd_intel8x0 35969 2
    snd_ac97_codec 78393 1 snd_intel8x0
    snd_seq_dummy 7621 0
    snd_seq_oss 35777 0
    snd_seq_midi_event 11585 1 snd_seq_oss
    snd_seq 54097 5 snd_seq_dummy,snd_seq_oss,snd_seq_midi_event
    snd_seq_device 12621 3 snd_seq_dummy,snd_seq_oss,snd_seq
    snd_pcm_oss 54257 1
    snd_mixer_oss 21953 1 snd_pcm_oss
    snd_pcm 91973 3 snd_intel8x0,snd_ac97_codec,snd_pcm_oss
    snd_timer 28357 2 snd_seq,snd_pcm
    snd 58149 11 snd_intel8x0,snd_ac97_codec,snd_seq_oss,snd_seq,sn d_seq_device,snd_pcm_oss,snd_mixer_oss,snd_pcm,snd _timer
    soundcore 13345 2 snd
    snd_page_alloc 13765 2 snd_intel8x0,snd_pcm
    sk98lin 168353 0
    floppy 62421 0
    ext3 133193 1
    jbd 61785 1 ext3
    ata_piix 13253 2
    libata 49220 1 ata_piix
    sd_mod 22977 4
    scsi_mod 136457 3 usb_storage,libata,sd_mod

    Notice mine doesnt have a vfat module, and ill explain how to cure this, most distros have modules precomplied if you didnt complie your own kernel or if you had vfat support complied as a module, so all you really have to do to include vfat support in this case is /sbin/modprobe vfat, but notice you must be in root to do this. Also notice you must have modules usb_storage, and overall USB support for your chipset. Though most distros have detection and module setup pretty set, I notice on some usb_storage isnt loaded in by default, so mod probe usb_storage if this is the case. Once this is accomplished, we are ready to rocknroll.

    Alright now we got that set plug your USB device in and lets see if the Kernel ring buffer detects your Flash Drive.

    To do this you use dmesg, for for Fedora and most distros I have dealt with flash drives look like scsi to them so type this in dmesg | grep "SCSI device" and look for the size of your device and the naming convention assoiated with it.

    Heres what mine looks like.
    [stephan@localhost bin]$ dmesg | grep "SCSI device"
    SCSI device sda: 234441648 512-byte hdwr sectors (120034 MB)
    SCSI device sda: drive cache: write back
    SCSI device sda: 234441648 512-byte hdwr sectors (120034 MB)
    SCSI device sda: drive cache: write back
    SCSI device sdb: 234441648 512-byte hdwr sectors (120034 MB)
    SCSI device sdb: drive cache: write back
    SCSI device sdb: 234441648 512-byte hdwr sectors (120034 MB)
    SCSI device sdb: drive cache: write back
    SCSI device sdg: 1946624 512-byte hdwr sectors (997 MB)
    SCSI device sdg: 1946624 512-byte hdwr sectors (997 MB)
    SCSI device sdh: 2880 512-byte hdwr sectors (1 MB)
    SCSI device sdh: 2880 512-byte hdwr sectors (1 MB)

    Notice my Serial ATA drives are looked at like SCSI but the ones we should be concerned of is the size of your flash drive should be in there, in my case its a gig flash drive, with a 1 meg partiton for the password program to lock it (dont ask its one of those weird brands), so in my case the flash drive is sdg, with yours it may be different.

    Now we proceed to making a directory in /mnt to mount our flash drive, though some fedora distros mount it for you automatically, sometimes this doesnt always work and its nice to know how to do this. Also note fedora and mandrake use /media for most mountings, you can mkdir a directory for flash drives in there if you like.

    Anyway mkdir /mnt/flashie
    note you must be root to create a directory in /mnt

    Once this is accomplished we mount it like we always do but with one little flag added.

    mount /dev/sdg /mnt/flashie -t vfat
    the -t tells it the file system type, if no errors occur and your doing this in root I stress or you will be VERY frustrated, we are ready to cd into the flash drive.
    cd /mnt/flashie and you should be able to use it like you always do.

    Warning some have had bad experances of putting homework on flash drives and FORGETING to umount them, dont do this sometimes linux puts off really writing to storage devices untill later, umount forces it to write to the media before removing it from the root directory.

    Now the same applies for Debian and other possable systems, however Debian sometimes names usb flash drives as ubb but the idea is the same, so when you dmesg just pipe it into tail if you just plugged your usb in, and find it to be ubb1 or something simlar follow the same instructions.

    Anyway this is most likey a crude tutorial, but it was ment to expose you to operating with flash drives in linux, I hope thish as helped someone.

    Any comments email me at sbenton@gci.net

  2. #2

    Re:Mounting Flash Drives, How-To

    Just to add to this, most modern distros will auto-mount/unmount flash media. For example, if you have a USB thumb drive, just plug it in and it will auto-detect and mount itself for you.

    You must be running gnome-volume-manager for this to happen.

  3. #3
    Associate
    Join Date
    Jun 2005
    Posts
    27

    Re:Mounting Flash Drives, How-To

    [quote author=Tyr_7BE link=board=1;threadid=10537;start=0#msg94758 date=1119618214]
    Just to add to this, most modern distros will auto-mount/unmount flash media. For example, if you have a USB thumb drive, just plug it in and it will auto-detect and mount itself for you.

    You must be running gnome-volume-manager for this to happen.
    [/quote]

    Thank you for your contribution Tyr_7BE, however this tutorial was designed more along the lines that auto mount was a failure for some bizarre reason, and the details to mount it manually were needed. However you are absolutly correct sir.

Similar Threads

  1. CD-RW drives
    By ifred in forum Linux - Hardware, Networking & Security
    Replies: 4
    Last Post: 03-18-2004, 02:56 AM
  2. Cannot Access Other Drives & CD/CD Writer Drives
    By HyBriDJoKeR in forum Linux - Hardware, Networking & Security
    Replies: 26
    Last Post: 02-01-2004, 08:52 PM
  3. 2 cd drives
    By martin in forum Linux - Hardware, Networking & Security
    Replies: 28
    Last Post: 02-28-2003, 08:24 PM
  4. CD drives and SuSE 8.1
    By deskflier in forum Linux - Hardware, Networking & Security
    Replies: 2
    Last Post: 01-25-2003, 07:19 PM
  5. problems mounting my ZIP drives
    By chadm1967 in forum Linux - General Topics
    Replies: 8
    Last Post: 01-14-2002, 10:22 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •