Using Removable Media
Prev |  | Next

## Using Removable Media

### Accessing Removable Media

Thunar supports removable media if it was built with support for HAL, or if you are using FreeBSD. Note however that on FreeBSD 6.0 or newer, it is suggested to use HAL rather than the native support provided by Thunar.

#### To Mount Media

To mount media is to make the file system of the media available for access. When you mount media, the file system of the media is attached as a subdirectory to your file system.

To access media, insert the media in the appropriate device, or connect the new device to your computer (i.e. connect an USB stick to one of your USB ports). An object that represents the media is added to the side pane of the file manager. If `xfdesktop` is running and configured to display File/launcher icons this object will also be added to your desktop.

To actually mount the media, click on the object that represents the media. For example, to mount a floppy diskette, click on the Floppy Drive object in the side pane. The file manager will now add the file system of the media to your file system hierarchy and display the contents of the floppy diskette in the main area.

#### To Eject Media

If the drive for the media is a motorized drive (i.e. a CD-ROM drive), right-click on the media object in the side pane or on the desktop and choose Eject Volume. The media is ejected from the drive after a few seconds. If the drive for the media is not motorized (i.e. a floppy drive or an USB stick), right-click on the media object and choose Unmount Volume. After a short period of time, a notification will appear to inform you that it is now safe to remove the media or disconnect the drive from the computer.

However this notification will only be displayed if support for `libnotify` is enabled, and you have installed a notification daemon. A notification daemon for Xfce is available from the Xfce Goodies Project. If notification support is not available, wait until the context menu disappears before you remove the media or disconnect the drive.

Be aware that you cannot eject or unmount media that is still in use by one or more applications. Therefore if the file manager refuses to eject media, make sure you close all applications that were accessing the media, and be sure to also check command line applications running in `Terminal` windows.

Make sure to unmount removable media before ejecting. Do not eject a diskette from the floppy drive before your unmount the diskette. Do not remove an USB stick before you unmount the flash drive. If you do not unmount the media first you might lose data or cause your system to crash.

### Management of Removable Drives and Media

Thunar is also able to automatically manage removable drives and media if the thunar-volman package is installed on your system. Note however that this feature requires HAL support.

Now, if HAL support is available and `thunar-volman` is installed on your system, you can choose to enable the Volume Management feature of Thunar. Therefore, open the file manager preferences, go to the Advanced page and check the Enable Volume Management button.

The next step is to customize the management of removable drives and media to your needs. Click on the Configure link in the Volume Management section, right below the button. The Removable Drives and Media configuration dialog will be displayed.

If you have used the `gnome-volume-manager` previously, you should feel right at home, because it was designed to look and behave similar to `gnome-volume-manager`. The preferences are divided by device categories to make it easy to locate the option for you specific device.

The Storage page contains the most important options. As the name suggests these options apply only to storage devices like external harddisk drives, USB sticks and CD-ROMs. The Removable Storage options are described in detail below.

Mount removable drives when hot-plugged

  Enable this option to automatically mount file systems on removable drives (i.e. external harddisk drives or USB sticks) when such drives are plugged into the computer.

  This option must be enabled for certain other features to work with removable drives. For example, if you disable this option, certain kinds of portable music players cannot be detected any more and so, even if you enabled the Play music files when connected option on the Multimedia page, the specified command will not be run when you hot-plug your portable music player.

Mount removable media when inserted

  Enable this option to automatically mount file systems on removable media (i.e. CD-ROMs or DVDs) when you insert the media into the drive.

  This option must be enabled for certain other features to work with removable media. For example, if you disable this option, it is impossible to detect whether the removable media has auto-run capabilities, and so the Auto-run programs on new drives and media option has no effect for removable media.

Browse removable media when inserted

  Enable this option to automatically display the content of newly inserted media in the file manager. Note however, that the contents will only be displayed if no other action was possible or you choose to ignore the other possible actions. For example, if you insert a CD-ROM with auto-run capabilities and the Auto-run programs on new drives and media option is enabled, you will be prompted whether you want to allow or ignore the auto-run. If you choose to ignore the auto-run the contents will be displayed in the file manager.

Auto-run programs on new drives and media

  Enable this option to make use of auto-run capabilities of certain removable drives and media. See the Desktop Application Autostart Specification for details about the auto-run mechanism. To enhance security, you will always be prompted to confirm the auto-run.

  If the Windows emulator WINE is installed on your system, the auto-run mechanism will also try to run `autorun.exe` files using WINE.

Auto-open files on new drives and media

  Enable this option to make of auto-open capabilities of certain removable drives and media. See the Desktop Application Autostart Specification for details about the auto-open mechanism. To enhance security, you will always be prompted to confirm the auto-open.

The remaining options allow you to specify a command to run when a certain kind of media is inserted into a drive or a certain kind of external device is connected. The command can use three special variables, that will be substituted when the command is run:

`%d`

  Each appearance of `%d` in the command will be substituted with the device file path of the newly added device. For example, if you have plugged in an USB stick, the device file path will be `/dev/da0s1` or `/dev/sda1`.

  If no device file is associated with the device or the device file could not be found for some reason, the variable `%d` will be substituted with the empty string.

`%h`

  Each appearance of `%h` in the command will be substituted with the HAL UDI of the newly added device.

`%m`

  Each appearance of `%m` in the command will be substituted with the mount point where the newly added device was mounted. If the device cannot be mounted (for example printers or keyboards) or if the automatic mounting was disabled, `%m` will be substituted with the empty string.

#### Troubleshooting the Volume Manager

Useful tips to trouble shoot the volume manager in case it does not work as expected.

1. Make sure `Thunar` is running as daemon. The volume manager depends on this, as it is not a daemon by itself. By default, Xfce automatically spawns `Thunar` as daemon on startup. If it got killed for some reason, open the Run program (using the keyboard shortcut Alt+F2 or right-click on the desktop and choose Run Program... from the desktop menu), enter `Thunar --daemon` and click Run.

2. Try running `thunar-volman` from a `Terminal` window after hot-plugging the drive or inserting the media. First, you need to figure out the HAL UDI of the new device using `lshal` or `hal-device`. Once you know the UDI, run `thunar-volman --device-added <udi-of-your-device>` in a `Terminal` window and watch the output for errors or warnings.

If it still refuses to work, ask on the Xfce Forum or the thunar-dev mailing list for help.

Prev |  | Next
Working with Files and Folders | Home | File Management Preferences