8

How to mount a usb or micro sd card, when Linux does not automount

September 27, 2011 by

This is something I am asked by n00bs a lot. My Linux system doesn’t automount my USB or micro sd card / camera card, what do I do now?

(NOTE: You can usually tell an automounted device because it will have a mount point of

/media/volumelabel

First of all, like Douglas Adams said: Don’t panic!

The first thing you want to do, is to find out if Linux can first see the device? How? Easy.

1. The first thing we want to do, is see if Linux see’s the device? How? Easy! lsusb


lsusb

Sample lsusb output

nwayno@Homer:~$ lsusb
Bus 002 Device 003: ID 03f0:4211 Hewlett-Packard OfficeJet 7300 series
Bus 002 Device 002: ID 051d:0002 American Power Conversion Uninterruptible Power Supply
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 010: ID 0951:1603 Kingston Technology DataTraveler 1GB/2GB Pen Drive
Bus 001 Device 006: ID 0488:0022 Cirque Corp.
Bus 001 Device 004: ID 0bc2:3000 Seagate RSS LLC
Bus 001 Device 002: ID 0409:005a NEC Corp. HighSpeed Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

and sure enough the device I am looking for is present:

Bus 001 Device 010: ID 0951:1603 Kingston Technology DataTraveler 1GB/2GB Pen Drive

It is NOT mounted, but I know that Linux can see it.

2. The second step is to determine what the device is called. How do you do that? blkid. blkid will list all the block devices attached to a system. NOT necessarily mounted. We want ALL devices, so we do that as root. Be patient! This can take a couple of minutes (Your patience will be rewarded.)


sudo blkid

Sample blkid output

nwayno@Homer:~$ sudo blkid
[sudo] password for nwayno:
/dev/sda1: LABEL=”Homer699″ UUID=”12345AB567″ TYPE=”ntfs”
/dev/sda2: UUID=”4dac-408816aecd1e” TYPE=”swap”
/dev/sda3: LABEL=”homer” UUID=”4e75-985fd59115e4″ TYPE=”ext4″
/dev/sda4: LABEL=”waynohome” UUID=”bc4-4c34-9d7d-3f5a56d13″ TYPE=”ext4″
/dev/sdb1: LABEL=”BFDNTFS” UUID=”FC1687414″ TYPE=”ntfs”
/dev/sdb2: LABEL=”bfdlinux” UUID=”143-4c0-4db-a392-55fb94a0f” TYPE=”ext4″
/dev/sdd1: UUID=”7E-4CEC” TYPE=”vfat”
/dev/sdd2: UUID=”42062a-9f99-a4ec71894″ TYPE=”ext4″
nwayno@Homer:~$

Notice that all the devices on my system were listed. Both mounted and umounted.

So the guy I am looking for is /dev/sdd1

YOUR DEVICE MAY BE A DIFFERENT NAME.. Remember the device is STILL not mounted at this point.

We know that /dev/sdd1 is vfat which is pretty typical of micro-sd cards. They are almost always vfat.

3. We have a couple of choices on mounting the device. We can use the a system mount point /mnt or create one with mkdir. I’ll only show the mount with the system mount point, but it could easily be anything that you create. Remember that to Linux, a device is just a mount point.

4. So become root, and mount the device:


sudo mount -t vfat /dev/sdd1 /mnt

YOUR DEVICE MAY BE A DIFFERENT NAME.

Remember, only root can mount/unmount (umount) devices.

The -t tells us that the device is vfat (windows). We got that from the blkid command. If it’s not vfat, the output of blkid well tell us what the file structure is. Use man mount for more information.

/dev/sdd1 was also obtained from the blkid information, tells us to associate this device with the mount point that follows: /mnt.

5. To access you files, launch your file browser (I use nautilus and just navigate (Filesystem/mnt directory) or just do a a cd to the /mnt directory:

/mnt directory

And the contents of /mnt are:

contents of /mnt


cd /mnt

6. List the files:


ls

and you should get some output:

A6VWN4.pdf
aztcs.htm
budgeting
discovery
FNPACK
ubuntu_11.04.png
ubuntu_11.04_unity.png
unity_11_04.png
vsftpd.conf_25K

7. And how much space do you have left on that device?


df -h

the df command displays used and free space on the device:

Sample df -h output

nwayno@Homer:~$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 50G 23G 25G 48% /
none 934M 268K 933M 1% /dev
none 940M 1.5M 939M 1% /dev/shm
none 940M 344K 940M 1% /var/run
none 940M 4.0K 940M 1% /var/lock
/dev/sda4 834G 306G 486G 39% /home
/dev/sdb2 773G 397G 337G 55% /media/bfdlinux
/dev/sdb1 147G 90G 58G 61% /media/BFDNTFS
/dev/sdd1 975M 847M 128M 87% /mnt
nwayno@Homer:~$

YOUR DEVICE MAY BE A DIFFERENT NAME.

In my case I have used 847M, and have 128M free on a 975M device (/dev/sdd1 above or /mnt)

8. All done? Umount the device, and sync the output.


umount /dev/sdd1

YOUR DEVICE MAY BE A DIFFERENT NAME.


sync

sync flushes the buffers, writes any pending data to the drive, and avoids data loss!

Easy! Painless!

Wayno

8 Responses to How to mount a usb or micro sd card, when Linux does not automount

  1. Pingback: How to label an ms-dos Flash Drive or Micro SD card using mtools in Linux

  2. sandeep

    i have created two partitions on my SD card how to mount these two partitions.I got to send some stuff to sdb1 and then to sdb2. how?

  3. Wayno Post author

    simply mount the second partition with the same commands and change the mount point.

    so the first parition may be /mnt
    the second partition may be /mnt/second

    it assumes you create a the second mount point
    with a

    sudo mkdir /mnt/second

    BEFORE MOUNTING.

    then:

    sudo mount /dev/sdb2 /mnt/second

    Use nautilus or whatever programme you like and copy what you need.

    Wayno

  4. anne

    hi,
    i am trying to mount an usb disk to which i have no access otherwise. i can see it with lsusb

    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 001 Device 003: ID 04f2:b093 Chicony Electronics Co., Ltd
    Bus 004 Device 002: ID 08ff:2810 AuthenTec, Inc. AES2810
    Bus 002 Device 007: ID 1058:0730 Western Digital Technologies, Inc.

    but can’t find it with blkid. the devices listed then are the same as before connecting my usb disk.

    /dev/sda1: UUID=”577d15fb-317e-4c86-8e67-601d2b6f3226″ TYPE=”ext4″
    /dev/sda5: UUID=”327bf6aa-75ef-4898-b3f9-1960c227b2c0″ TYPE=”swap”

    any idea? thanks!

  5. salmon2k

    What if the device will not show at all?
    what is the command to do a “force” mounting of all possible devices?

    Please advise,

    Alex.

  6. Wayno Post author

    Alex:

    sudo blkid will show all devices on the system mounted or not. If blkid and or lsusb does not show it, then you may have bios issues, or other issues.

    How was the device formatted? Does it work on another computer?

    If you want to remount all devices:

    sudo mount -a -o remount

    HOWEVER: while this remounts all the devices it only remounts previously mounted devices.

    -a says mount all devices listed in /etc/fstab
    -o allows the specification of mount options. In this case, remount

    Wayno

Add Comment Register



Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>