个人工具

UbuntuHelp:UsbFlashDrives

来自Ubuntu中文

Wikibot讨论 | 贡献2008年4月23日 (三) 12:01的版本

跳转至: 导航, 搜索

This page explains how to use USB flash drives - USB sticks and other USB storage devices - with Ubuntu.

Introduction

USB storage devices have the enormous advantage that for the most part they use a standard set of protocols. Thus, instead of needing individual drivers, as does much computer hardware, a standard driver permits access to the devices, making them very portable and able to easily work on many platforms. More:

Use

You can see a list of your USB devices (the vendor and device ID's)

 lsusb

Mounting your USB drive

Generally all you need to do to use your storage device is to plug it into a USB port. The device should be automatically recognised and appear on your GNOME desktop.

Unmounting/Ejecting your USB drive

This is an important thing to do. When you have finished using your storage device, you must right click on it's icon and select eject before unplugging it. This ensures that any files being written to the device are permanently saved and informs any programs that may be using files on the device.

More

Troubleshooting

As always, there is exceptions to the rules, and you might encounter some problems to mount your USB device. We present here some common problems you could encounter (if you know others, please share them here. Thanks)

User Privileges

If your usb device doesn't appear on your desktop, you should check that your user has the correct privileges:

  • Navigate to "System" > "Administration" > "User and Groups"
  • Choose the user, click on "Properties"
  • Go to the "User Privileges" tab

You should have the "Access external storage devices automatically" option checked.

Preferences

If your usb device doesn't appear on your desktop, you should check that the automount action is enabled in the preferences:

  • Navigate to "System" > "Preferences" > "Removable Drives and Media"
  • Verify that all "Mount removable drives when..." are checked.

File systems

A new ext3 file system

WARNING: formating a flash drive is going to delete all its content. To put a new ext3 file system on it put the key in your computer and learn which USB port has it. Now lets just do this in a terminal:

$ sudo mkfs.ext3 USB-port 

and put the real port in. You can see the proper port by looking at /media (where the USB Flash Drive is mounted], or the error message. If the format is a success your computer will load it as a new file system. More about file systems:

  • aufsRootFileSystemOnUsbFlash

General tip

When you encounter problems with an USB device, the first thing to do is to check the latest debug information from the kernel just after you plug your device and/or just after you encounter a problem. To do that, open a terminal and type :

dmesg

Check the latest message, they should be related to your problem.

USB 2 Issues

If you encounter problems using your USB device with USB 2 (i.e. 'high speed' mode), you can revert to the 'full speed' mode (slower) by unloading ehci_hcd. To do that, type in a terminal :

sudo rmmod ehci_hcd

before pluging your device.

Buffer I/O Errors

If you see errors related to Buffer I/O when attaching a USB Storage device, there are two ways to work around it. First, try using varying max_sectors settings, as such:

sudo sh -c "echo 120 > /sys/block/sda/queue/max_sectors_kb"

Try values of 120, 64 and 32. If this does not resolve the issue, then you may need an unusual_dev entry for your device. It would look something like this:

UNUSUAL_DEV(0x03eb , 0x2002, 0x0100, 0x9999,
            "Generic",
            "MusicDrive",
            US_SC_DEVICE, US_PR_DEVICE, NULL,
            US_FL_IGNORE_RESIDUE),

The vendor and device ID's can be obtained from the output of "lsusb". The entry would be placed in drivers/usb/storage/unusual_devs.h. If you cannot compile your own kernel, please file a bug report, and we'll attempt to compile a test module for you.

Device become suddenly read only

If your device change suddenly to read only mode, and you see that kind of error:

[17183798.908000] FAT: Filesystem panic (dev sda1)
[17183798.908000]     fat_get_cluster: invalid cluster chain (i_pos 0)
[17183798.908000]     File system has been set read-only

This might be the sign of an unclean device. You should check your device. Try TestingStorageMedia to do so.

See also