Quantcast
Viewing all articles
Browse latest Browse all 11

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

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:

Image may be NSFW.
Clik here to view.
/mnt directory

And the contents of /mnt are:

Image may be NSFW.
Clik here to view.
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


Viewing all articles
Browse latest Browse all 11

Trending Articles