Wednesday, 31 March 2010

Mounting USB drives in Lubuntu

It's been a while since I had to do this. I've gotten so used to regular Ubuntu and Nautilus and layers of auto-mounting drive-enabling modules under the hood, it took a while to re-adjust the mindset by about 18 months and do this by hand...
Until PCManFM (Lubuntu's default file manager) catches up and takes on a few more features, we'll have to use some terminal magic.

Plug in your USB storage (pen drive, external HD, phone. Open LXTerminal, enter:
This lists available usb devices (active or not)
Find your drive in the list, to make sure Lubuntu recognises it. Next, enter:
sudo fdisk -l
You need sudo to carry out commands with administrator permissions (otherwise, no-can-do). fdisk with the -l (lower case L) option for list will show all storage devices with a device identifier - sda1, sdb2 and so on.

On the Compaq, I get:
Disk /dev/sda: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00032653
   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1         973     7815591   83  Linux
/dev/sda2             974       14593   109402650    5  Extended
/dev/sda5           14229       14593     2931831   82  Linux swap / Solaris
/dev/sda6             974        1702     5855629+  83  
Partition table entries are not in disk order
Disk /dev/sdb: 86 MB, 86016000 bytes
3 heads, 18 sectors/track, 3111 cylinders
Units = cylinders of 54 * 512 = 27648 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000340ae
   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1        2628       70932+   4  FAT16 <32M
Decide on a label for the USB drive you're mounting (such as flash). Then enter:
sudo mkdir /media/flash
sudo mount /dev/sdb1 /media/flash
mkdir or make directory creates a folder under /media to use as a placeholder; then the mount command hooks your drive's root folder onto that for use.

When you've finished
There is no 'safely remove drive' utility either. Enter:
sudo umount /media/flash
which unmounts the drive - yes it is umount with one nRC


  1. Very odd...
    I have LXDE on top of Juanty Xubuntu.
    It has Pcmanfm 0.5 on it.
    I have no problems mounting/unmounting my usb
    sticks. Never had to use a terminal command to do so.
    I put in the stick, the manager sees it right away.
    I right click to unmount.

  2. I find it odd, too. However, the Lubuntu Alpha is SO stripped down right now, I can imagine one or two missing libraries do the damage, particularly on my old hardware. I also expect the underlying Jaunty Xubuntu is providing much of the infrastructure in your case. RC

  3. I know this post is prehistoric, but I'll try.

    My USB camera shows on lsusb, but not as a drive on fdisk, so I can't mount it. Suggestions?

  4. Blanco: I haven't a Lubuntu rig available at the moment, but this sounds familiar. For removal of doubt, can you mount it under an Ubuntu Live session and/or Lubuntu live session? Make sure the storage in the camera is recognised and readable elsewhere before modifying your installed system.

    PCManFM is able to mount and unmount devices, both manually and automatically, even if it appears fdisk cannot. Note: You must have a /media folder and have permissions to mkdir an empty folder under which to mount them.

    In PCManFM > Edit > Preferences, check the settings for:
    X Mount mountable volumes automatically on program startup
    X Mount removable volumes automatically when they are inserted
    X Show available options for removable media automatically when they are inserted

  5. I recently installed Lubuntu 13.04 in an older machine (Athlon 2800XP+). It generally works fine and although PCManFM's preferences are set as per your suggestions, no unmount or eject options are shown. The flash stick, or external drives are properly shown in the "media" file and in "my computer" and they work fine. Any ideas?

  6. shoes this error

    "mount: special device /dev/sdb1 does not exist"


At least try to be nice, it won't kill you...