使用可移除式媒體

存取可移除式媒體

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.

掛載媒體

掛載 媒體是要讓媒體的檔案系統可供存取。當您掛載媒體時,該媒體的檔案系統會以子目錄的方式連接至您的檔案系統。

若要存取媒體,請將媒體插入適當的裝置,或是將新裝置接上您的電腦 (例:將 USB 隨身碟插入您的 USB 連接埠)。接著一個代表該媒體的物件會加入檔案管理員的側窗格內。如果 xfdesktop 正在執行中,並且被設置為會顯示檔案/啟動器圖示的話,此物件也會加入至您的桌面上。

若要實際掛載媒體,請點擊代表該媒體的物件。比如說您要掛載軟碟片的話,就點擊側窗格內的軟碟機。接著,檔案管理員將立刻將該媒體的檔案系統加入至您的檔案系統階層目錄內,並且在主要區域內顯示軟碟片的內容。

退出媒體

如果媒體的裝置屬於機動型裝置 (例:光碟機),在側窗格或是桌面上對該媒體物件點擊右鍵,接著選擇退出儲存裝置。該媒體將在幾秒後從裝置中退出。如果媒體的裝置屬於非機動型 (例:軟碟機或 USB 隨身碟),對該媒體物件點擊右鍵,接著選擇卸載儲存裝置。一小段時間後,系統會顯示通知以通知您現在從電腦移除媒體或是斷開裝置連接是安全的。

Unmount notification

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.