Search:  
Gentoo Wiki

Mount_removable_media

Have your USB flash drive, Firewire harddrive, CD-ROM or any other external media manually or automatically mounted.

Contents

Requirements

Linux Kernel Configuration:
File systems  --->
    DOS/FAT/NT Filesystems  --->
        <*> MSDOS fs support
        <*> VFAT (Windows-95) fs support
        Change this to your locale
       (437) Default codepage for FAT
       (iso8859-1) Default iocharset for FAT
    -*- Native language support  --->
        <M>   Codepage 437 (United States, Canada)
        <M>   NLS ISO 8859-1  (Latin 1; Western European Languages)
For more informations see this guide.
  • For NTFS formated media: See this guide
  • For CD / DVD / Blueray disk:
Linux Kernel Configuration:
File systems  --->
    CD-ROM/DVD Filesystems  --->
        <M> ISO 9660 CDROM file system support
        [*]   Microsoft Joliet CDROM extensions
        <M> UDF file system support
  • For HFS+ partitions (used primarily by Apple products such as the iPod and MacOS X):
Linux Kernel Configuration:
File systems  --->
    Miscellaneous filesystems  --->
        <M> Apple Extended HFS file system support
# usermod Add your user name here -aG plugdev

Remember that you must log out and back in before the changes will take effect.

For maximum interoperability between Windows (Win98 and later), OS X, and Linux, partitioning your device as VFAT (FAT32) is recommended. You can also compile the file systems as modules (udev will pick them up).

Now compile and install your kernel.

HAL

Ensure that you have the "hal" USE flag in /etc/make.conf. It is best to re-emerge all affected packages with emerge -uavDN world.

Now add HAL to the "default" runlevel so that it is started on boot:

rc-update add hald default
/etc/init.d/hald start

Mounting

Try to plug in a removeable media. To verify it was mounted, use this while mounting:

tail -f /var/log/messages

This command reads the tail of your log messages to see what is going on with your system. If you see something similar to fstab-sync: added mount point /media/usbdisk for /dev/sdc1 then the automounting should be successful.

In the input tabs when entering commands to execute when media/devices are inserted, %d will be replaced with the device name and %m will be replaced with the path to the mounted volume.

GNOME

See this guide.

KDE

There is no guide, but KDE support mounting removable media out of the box after having hald started.

Xfce

See this guide.

Universal method

See this guide.

Manual method

You can find the correct device name by at /dev/disk/by-id/ (ls -l /dev/disk/by-id/) or by using fdisk (fdisk -l).

Now create a target directory and mount the drive:

mkdir /mnt/usbstick
mount /dev/device /mnt/usbstick

Use umount to unmount the drive:

umount /mnt/usbstick
or
umount /dev/device

Advanced Topics

Predefined symlink

If your working with lots of removable media, they are all driven by the SCSI subsystem, so they show up as /dev/sdb, /dev/sdc and so on. If you want e.g. backup your files by script, you have to tell the script which device to use. In the past, with the appearance of udev, it was possible to define a fixed symlink to the device file (like e.g. /dev/usbdrive). Nowadays you can use the symlinks in /dev/disk/by-id/

Troubleshooting

Wrong fs type, bad superblock, etc.

Your kernel needs to support the filesystem

FAT: cpage437 not found

If dmesg shows errors like FAT: cpage437 not found, add Codepage 437 (United States, Canada) and NLS ISO 8859-1 (Latin 1: Western European Languages) support to the kernel.

USB fails without error

The file /usr/share/hal/fdi/policy/gparted-disable-automount.fdi will cause hal to ignore USB events. It may be left after a GParted crash, so it's safe to remove it if GParted is not running.

Permissions

If you receive this message : "You are not privileged to mount the volume '...'" when you insert a CD, remove (or comment) the lines about your CD-ROMs in /etc/fstab [1]

Older Macintosh Filesystems

As of 2.6.11, HFS (which is used by older Macs) is available experimentally and UFS (which is used on some OS X machines for greater Unix compatibility) is available in read-only.

Retrieved from "http://www.gentoo-wiki.info/Mount_removable_media"

Last modified: Wed, 10 Sep 2008 22:21:00 +0000 Hits: 3,310