Как найти путь к флешке linux

Device names of flash drives

A flash drive can be connected

  • via USB (typically a USB stick or a memory card via a USB adapter)

  • the device name is the same as for SATA drives, /dev/sdx

  • and partitions are named /dev/sdxn

where x is the device letter and n the partition number, for example /dev/sda1

  • via PCI (typically a memory card in a built-in slot in a laptop)

  • the device name is /dev/mmcblkm

  • and partitions are named /dev/mmcblkmpn

where m is the device number and n the partition number, for example /dev/mmcblk0p1

Example with an SSD, HDD, USB pendrive and an SD card

lsblk

$ sudo lsblk -o model,name,fstype,size,label,mountpoint
MODEL            NAME        FSTYPE    SIZE LABEL              MOUNTPOINT
Samsung SSD 850  sda                 232,9G                    
                 ├─sda1      vfat      300M EFI                /boot/efi
                 ├─sda2                  1M                    
                 ├─sda3      ext4      100G root               
                 └─sda4      swap        5G                    [SWAP]
00BEKT-00PVMT0   sdb                 298,1G                    
                 ├─sdb1      vfat      480M                    
                 ├─sdb2      ext4       80G lubuntu-xenial64   /media/tester/lubuntu-xenial64
                 ├─sdb3      swap      3,9G                    [SWAP]
                 ├─sdb4      ext4      100G ubuntu-artful64x   /
                 └─sdb5      ext4    113,7G ubuntu-artful64w   /media/tester/ubuntu-artful64w
Extreme          sdc                  14,6G                    
                 ├─sdc1      ntfs      6,7G usbdata            /media/tester/usbdata1
                 ├─sdc2                  1M                    
                 ├─sdc3      vfat      244M usbboot            
                 ├─sdc4      iso9660   948M Lubuntu 17.10 i386 /media/tester/Lubuntu 17.10 i386
                 └─sdc5      ext4      6,7G casper-rw          /media/tester/casper-rw
                 mmcblk0               3,7G                    
                 ├─mmcblk0p1 ntfs      661M usbdata            /media/tester/usbdata
                 ├─mmcblk0p2             1K                    
                 ├─mmcblk0p3 vfat      122M usbboot            /media/tester/usbboot
                 ├─mmcblk0p4 iso9660   355M 9w-dus             /media/tester/9w-dus
                 └─mmcblk0p5 ext4      2,6G persistence        /media/tester/persistence

Edit for lsblk list: With modern versions of Ubuntu you need not use sudo, and when there are (many) snaps, and we don’t want them to clutter the list, you the following command line,

lsblk -o model,name,fstype,size,label,mountpoint | grep -v " loop.*snap"

parted

$ sudo parted -ls
[sudo] password for tester: 
Model: ATA Samsung SSD 850 (scsi)
Disk /dev/sda: 250GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End    Size    File system     Name  Flags
 1      1049kB  316MB  315MB   fat32                 boot, esp
 2      316MB   317MB  1049kB
 3      317MB   108GB  107GB   ext4            root
 4      244GB   249GB  5369MB  linux-swap(v1)


Model: WDC WD32 00BEKT-00PVMT0 (scsi)
Disk /dev/sdb: 320GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system     Name                  Flags
 1      33,6MB  537MB   503MB   fat32           EFI System Partition  boot, esp
 2      537MB   86,4GB  85,9GB  ext4
 4      86,4GB  194GB   107GB   ext4
 5      194GB   316GB   122GB   ext4
 3      316GB   320GB   4161MB  linux-swap(v1)


Model: SanDisk Extreme (scsi)
Disk /dev/sdc: 15,7GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system  Name     Flags
 2      1049kB  2097kB  1049kB               primary  bios_grub
 3      2097kB  258MB   256MB   fat32        primary  boot, esp
 4      258MB   1252MB  994MB                primary
 5      1252MB  8473MB  7221MB  ext2         primary
 1      8473MB  15,7GB  7221MB  ntfs         primary  msftdata


Model: SD SD04G (sd/mmc)
Disk /dev/mmcblk0: 3965MB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type      File system  Flags
 3      2097kB  130MB   128MB   primary   fat32        boot
 4      130MB   502MB   372MB   primary
 2      502MB   3272MB  2769MB  extended               lba
 5      503MB   3272MB  2768MB  logical   ext2
 1      3272MB  3965MB  693MB   primary   ntfs

So which device file is used for USB? How can i indentify it?

What you see behind /sys/ is mainly configuration/information about devices. /dev/bus/usb is what you are looking for. I think that the following article can help you

http://www.linuxjournal.com/article/7466?page=0,0

Is quite old, but still it can help you. (In the article they speak about /proc/bus/usb, today we have /dev/bus/usb)

Further more, could you explain to me the number 1-1:1.0? What does it mean?

The generic form is

X-Y.Z:A.B

Each field identify the connection point of your device. The first two field are mandatory:

  • X is the USB bus of your motherboard where is connected the USB system.
  • Y is the port in use on the bus system

So the USB device identified with the string 3-3 is the device connected on the port 3 of the bus 3.

If you connect an USB hub, you are extending the connection capability of a single USB port. The Linux kernel identify this situation by appending the Z field.

  • Z is the port is use on an hub

So, the USB device identified with the string 1-2.5 is the device connected on the port 5 of the hub connected on the port 2 of the bus 1.

USB specification allow you to connect in cascade more then one USB hub, so the Linux kernel continue to append the port in use on the different hubs. So, the USB device identified with the string 1-2.1.1 is the device connected on the port 1 of the hub connected on the port 1 of the hub connected to the port 2 of the bus 1.

A fast way to retrieve these information is to read the kernel messages (if you can).

$ dmesg | grep usb
[... snip ...]
[ 2.047950] usb 4-1: new full-speed USB device number 2 using ohci_hcd
[ 2.202628] usb 4-1: New USB device found, idVendor=046d, idProduct=c318
[ 2.202638] usb 4-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 2.202643] usb 4-1: Product: Logitech Illuminated Keyboard
[ 2.202648] usb 4-1: Manufacturer: Logitech
[... snip ...]

Then, the last two fields of the pattern (after colon) identify an internal section of an USB device :

  • A is the configuration number of the device
  • B is the interface number of a configuration

So, the string 4-1:1.1 means: the interface 1, on configuration 1 that is connected on the port 1 of the bus 4.

You can retrieve these information with the command lsusb.

Как примонтировать флешку в Linux

В наши дни очень большую популярность у пользователей набрали USB флешки. Они используются для обмена файлами, различными фильмами и документами, установки операционных систем, а также восстановления системы после сбоя. Чтобы работать с флешкой в Linux ее нужно примонтировать в корневую файловую систему.

Дело в том, что организация файловой системы Linux немного отличается от того, что мы привыкли видеть в Winodws. Здесь нет никаких дисков C,D,E и так далее, есть только корень, самая верхняя точка файловой системы, в подкаталоги которой подключаются все жесткие диски и внешние носители.

Если в системе используется окружение рабочего стола, то оно, как правило, берет на себя всю низкоуровневую работу чтобы выполнить монтирование флешки в linux. Система обнаруживает подключенную флешку и в системном лотке всплывает уведомление о подключенном устройстве. Дальше остается кликнуть по значку флешки, чтобы система выполнила все нужные для ее монитрования действия. Но если окружение рабочего стола не запущенно или вам нужно работать в консоли можно выполнить все действия по монтированию флешки вручную.

В этой инструкции мы рассмотрим монтирование usb флешки в linux через терминал, а также настройку автоматического монтирования для оконных менеджеров, которые не поддерживают такую возможность.

Монтирование флешки в Linux

Самое первое, что нужно сделать после того, как вы подключили флешку — узнать имя ее файла в системе. В Unix все устройства имеют свои файлы и именно через эти файлы система и программное обеспечение взаимодействуют с ними.

Файлы флешек и других устройств хранения данных находятся в каталоге /dev. Устройства нумеруются по алфавиту sda, sdb, sdc, sdd и т д. Так как флешка подключается последней у нее будет старшая буква. Например, sdb или sdc. Имя sda принадлежит жесткому диску. Можно, конечно, просто посмотреть содержимое каталога /dev/, но такой способ ненадежный. Мы воспользуемся утилитой fdisk.

Подключите флешку и выполните:

Как видите, здесь мы можем посмотреть детальную информацию об устройстве. Имя файла, список разделов, формат таблицы разделов, список разделов. А главное для нас, размер раздела и его файловую систему. Теперь не сложно понять какая из них флешка. В этом примере это /dev/sdc1

Создаем папку для монтирования:

Теперь монтируем флешку с помощью команды mount:

sudo mount /dev/sdc1 /mnt/usb

Если знаете файловую систему флешки, то лучше ее указать с помощью опции -t. Чаще всего используется FAT, так как ее легко открывают как Windows так и Linux системы:

sudo mount -t vfat /dev/sdc1 /mnt/usb

Монтирование осуществляется от суперпользователя, но если нужно чтобы отмонитровать флешку мог любой нужно указать опцию users:

sudo mount -t vfat -o users /dev/sdc1 /mnt/usb

По умолчанию владельцем файлов на флешке при монтировании устанавливается root, поэтому если вы захотите работать с флешкой через файловый менеджер, то нужно будет его запускать с правами суперпользователя или же сразу примонтировать флешку в linux таким образом, чтобы владельцем был ваш пользователь. Для этого укажите группу и id своего пользователя в опциях uid и gid:

sudo mount -o users,uid=1000,gid=1000 /dev/sdc1 /mnt/usb

Удостовериться что флешка подключена можно посмотрев содержимое каталога, в который мы ее монтировали:

Или выполнив команду mount:

После завершения работы с флешкой не забудьте ее отмонтировать. Потому что иначе данные могут быть не сохранны или вообще повреждена файловая система флешки:

sudo umount /dev/sdc1

Автоматическое монтирование флешки в Linux

Популярные окружения рабочего стола выполняют монтирование флешки linux автоматически, как только она подключена к системе или по клику на ярлыке. Мы можем это реализовать с помощью службы udisks2.

Udisks — это служба dbus, позволяющая другим программам и пользователю взаимодействовать с udev. Мы можем получать сообщения о только что подключенных устройствах, выполнять их монтирование и отключение. Окружения рабочего стола используют именно этот сервис для монтирования устройств.

Мы тоже можем использовать его для ручного монтирования. Здесь даже есть несколько плюсов. Во-первых, мы можем монтировать без прав суперпользователя, во-вторых, не нужно создавать папку.

Для монтирования используется такая команда:

udisksctl mount -b /dev/sdc1

Здесь /dev/sdc1 — файл нашей флешки, а опция -b указывает, что нужно монтировать блочное устройство. Так же как и в mount здесь можно задать опции монтирования -o и файловую систему -t. Флешка будет примонтирована в папку /run/имя_пользователя/uuid-флешки/

Для размонтирования используется аналогичная команда:

udisksctl unmount -b /dev/sdc1

Автоматическое монтирование usb флешки в linux можно настроить с помощью утилиты udiskie. Все новые подключенные флешки будут автоматически подключаться, после подключения устройства будет всплывать окно с предложением открыть файловый менеджер, а также значок, с помощью которого можно получить доступ к каждому из устройств.

Устанавливается утилита в Ubuntu командой:

sudo apt install udiskie

Дальше остается запустить программу:

Теперь все подключаемые устройства будут автоматически монтироваться с помощью udisks. Рассмотрим что значат опции:

  • -a — выполнять автоматическое монтирование
  • -n — показывать всплывающее уведомление
  • -t — показывать значок в трее.

Выводы

Теперь монтирование флешки linux не вызовет у вас проблем. Даже если у вас не будет работать окружение рабочего стола и придется делать все вручную. Если остались еще вопросы, спрашивайте в комментариях.

Источник

Как посмотреть usb устройства Linux

При подключении USB флешки или любого другого USB устройства к компьютеру создается набор файлов, с помощью которых вы можете получить к ним доступ. Когда вы работаете в файловом менеджере все достаточно просто, но как только дело доходит до консоли все становится намного труднее.

Каждому новичку важно уметь идентифицировать подключенные устройства, будь то usb флешки, SD карты или жесткие диски чтобы не записать что-либо не туда или не отформатировать не тот диск. В этой статье мы рассмотрим несколько способов как посмотреть usb устройства Linux, подключенные к компьютеру.

Список подключенных устройств Linux

В операционной системе Linux используется особенная философия управления. Все объекты, в том числе и устройства считаются файлами. При подключении какого-либо устройства к системе для него создается файл в каталоге /dev/.

Обычно, после того, как вы подключили любую USB флешку или другой накопитель к системе с установленным окружением рабочего стола, устройство автоматически монтируется в папку /media/имя_пользователя/метка_устройства/, а затем вы можете получить доступ к файлам из устройства в этой папке. Тем не менее, бывают ситуации, когда вам нужно вручную монтировать USB и тогда такой вариант не поможет.

Файлы всех устройств находятся в каталоге /dev/. Здесь вы можете найти файлы sda, hda, которые представляют из себя жесткий диск, а также файлы sda1 или hda1, которые позволяют получить доступ к разделам диска. Мы уже подробно рассматривали это все в статье работа с устройствами Linux. Вы можете посмотреть список всех устройств в каталоге /dev/ с помощью команды:

Теперь осталось понять какие из этих файлов устройств принадлежат USB устройствам и каким устройствам именно.

Как посмотреть USB устройства Linux

Чтобы узнать более подробную информацию о каждом устройстве, подключенном к вашей системе и посмотреть список устройств linux, можно использовать команду df. Она используется для просмотра свободного места на диске:

По общему размеру и занятому пространству вы можете определить какое из устройств является вашей флешкой, но этот способ посмотреть устройства linux не очень удобен и работает он только с уже смонтированной флешкой, есть еще несколько, дающих более точную информацию.

Команда lsblk отображает список всех блочных устройств, подключенных к вашему компьютеру. Утилита отображает не только их размер, но и тип (диск/раздел) а также старший и младший номер устройства. Тут уже немного проще найти флешку, мы видим два диска, и если первый с размером 698 гигабайт это жесткий диск, то второй, — точно флешка:

Есть еще один способ, это утилита fdisk. Она позволяет посмотреть таблицу разделов на всех блочных устройствах, подключенных к компьютеру. Но утилиту нужно выполнять от имени суперпользователя:

Также, узнать о подключенном USB устройстве можно посмотрев очередь сообщений ядра dmesg. Здесь хранится информация обо всех операциях, которые происходят в ядре. В том числе здесь будет отображено имя флешки, только что подключенной к компьютеру. Для просмотра сообщений ядра выполните:

Чтобы посмотреть какие из sd устройств относятся к USB используйте такую команду:

ls -l /dev/disk/by-id/usb*

Попытаться идентифицировать свою флешку в системе через терминал можно с помощью утилиты blkid. Она выводит UUID идентификаторы всех подключенных устройств, а также файловую систему:

Выводы

В этой статье мы рассмотрели как посмотреть usb устройства linux, а также как узнать имя своей usb флешки в системе. Вы можете использовать любую из команд, которая вам понравилась, или же сразу несколько. Но теперь вы знаете как точно определить имя файла своей флешки.

Источник


Автор
Тема: как определить путь к usb устройству?  (Прочитано 7360 раз)

0 Пользователей и 1 Гость просматривают эту тему.

Оффлайн
Userz

  • Автор темы
  • Любитель
  • *
  • Сообщений: 96
    • Просмотр профиля

как определить путь к usb устройству?

« : 22 Декабря 2010, 20:24:38 »

Подскажите пожалуйста как определить путь к usb устройству? /dev/usb/? ? ?
lsusb

(Нажмите, чтобы показать/скрыть)

lsusb -v

(Нажмите, чтобы показать/скрыть)


Оффлайн
suslikk

  • Старожил
  • *
  • Сообщений: 2485
    • Просмотр профиля

Re: как определить путь к usb устройству?

« Ответ #1 : 22 Декабря 2010, 22:51:53 »

Вы об этом http://ubuntuforums.org/archive/index.php/t-381096.html ?

Нарисуй свой город на openstreetmap.org


Оффлайн
Userz

  • Автор темы
  • Любитель
  • *
  • Сообщений: 96
    • Просмотр профиля

Re: как определить путь к usb устройству?

« Ответ #2 : 23 Декабря 2010, 00:01:41 »

Вообще хотелось бы узнать, есть ли стандартный метод определения пути?


Оффлайн
SureGOOD

  • Активист
  • *
  • Сообщений: 724
  • suregood.ru
    • Просмотр профиля
    • suregood.ru

Re: как определить путь к usb устройству?

« Ответ #3 : 23 Декабря 2010, 13:23:29 »

После подключения делайте dmesg и смотрите где находится файл устройства.
Потом mount /dev/sd**
Профит)
Если я правильно вопрос конечно понял.

suregood.ru


Contents

  1. Introduction
  2. Automounting

    1. Mounting
    2. Configuring Automounting
    3. Configuring Program Autostart
    4. Auto-mounting (Ubuntu Server)
  3. Manually Mounting

    1. Using Disks
    2. Using mount
    3. Using pmount
  4. The Importance of Unmounting
  5. Other Useful Commands
  6. Troubleshooting

    1. Interfering services
    2. Unclean LogFile
    3. User Privileges
    4. Preferences
    5. USB 2 Issues
    6. Buffer I/O Errors
    7. Device suddenly becomes read-only
    8. USB-Device is or becomes read-only without errors
    9. General tip
    10. Seeking Further Help
  7. Other Resources

Introduction

This page explains how to use USB drives, like external hard disks and USB flash drives (aka USB sticks, thumb drives, pen drives, etc). The material here also applies to flash cards (like in your digital camera).

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.

IconsPage/stop.png

For help with internal hard drives, see Fstab and MountingWindowsPartitions.

Automounting

Mounting

By default, storage devices that are plugged into the system mount automatically in the /media/<username> directory, open a file browser window for each volume and place an icon on your desktop. The rationale for this slight change of behavior can be found here. If you plug in a usb hard disk with many partitions, all of the partitions will automatically mount. This behaviour may not be what you want; you can configure it as shown below.

If the volumes have labels the icons will be named accordingly. Otherwise, they will be named «disk», «disk-1» and so on.

To change the volume label see RenameUSBDrive.

Configuring Automounting

To enable or disable automount open a terminal and type:

dconf-editor

Browse to org.gnome.desktop.media-handling.

The automount key controls whether to automatically mount media. If set to true, Nautilus will automatically mount media such as user-visible hard disks and removable media on start-up and media insertion.

Another key, org.gnome.desktop.media-handling.automount-open, controls whether to automatically open a folder for automounted media.

If set to true, Nautilus will automatically open a folder when media is automounted. This only applies to media where no known x-content type was detected; for media where a known x-content type is detected, the user configurable action will be taken instead. This can be configured as shown below.

Configuring Program Autostart

To control which programs automatically start when you plug in a device, go to System-Settings — Details — Removable Media.

For more complex scenarios, see UsbDriveDoSomethingHowto.

Unmounting/Ejecting

Before you disconnect the device, don’t forget to unmount it. This can be done in one of the following ways:

  • Right-click the desktop icon and select «Unmount» (or in some cases, «Eject»).
  • In the file manager window, click on the «eject» button next to the name of the mounted volume.
  • Right-click the icon in the launcher and select «Unmount».

Auto-mounting (Ubuntu Server)

By default, disk drives do not auto-mount in Ubuntu Server Edition. If you are looking for a lightweight solution that does not depend on HAL/DBUS, you can install «usbmount».

Manually Mounting

Using Disks

Disks (the GNOME disk utility) is an application for visually managing disk drives and media. When you run it, you will see a list of your drives, including USB drives. If you click a drive on the list, you can view its details, and you can click the triangle-shaped button (Play button) to mount the drive. (This method works even when the drive does not auto-mount.)

Using mount

Get the Information

Sometimes, devices don’t automount, in which case you should try to manually mount them. First, you must know what device you are dealing with and what filesystem it is formatted with. Most flash drives are FAT16 or FAT32 and most external hard disks are NTFS. Type the following:

sudo fdisk -l

Find your device in the list. It is probably something like /dev/sdb1. For more information about filesystems, see LinuxFilesystemsExplained.

Create the Mount Point

Now we need to create a mount point for the device. Let’s say we want to call it «external». You can call it whatever you want, but if you use spaces in the name it gets a little more complicated. Instead, use an underscore to separate words (like «my_external»). Create the mount point:

sudo mkdir /media/external

Mount the Drive

We can now mount the drive. Let’s say the device is /dev/sdb1, the filesystem is FAT16 or FAT32 (like it is for most USB flash drives), and we want to mount it at /media/external (having already created the mount point):

sudo mount -t vfat /dev/sdb1 /media/external -o uid=1000,gid=1000,utf8,dmask=027,fmask=137

The options following the «-o» give you ownership of the drive, and the masks allow for extra security for file system permissions. If you don’t use those extra options you may not be able to read and write the drive with your regular username.

Otherwise, if the device is formatted with NTFS, run:

sudo mount -t ntfs-3g /dev/sdb1 /media/external

Note: You must have the ntfs-3g driver installed. See MountingWindowsPartitions for more information.

Unmounting the Drive

When you are finished with the device, don’t forget to unmount the drive before disconnecting it. Assuming /dev/sdb1 is mounted at /media/external, you can either unmount using the device or the mount point:

sudo umount /dev/sdb1

or:

sudo umount /media/external

You cannot unmount from the desktop by right-clicking the icon if the drive was manually mounted.

Using pmount

There is a program called pmount available in the repositories which allows unprivileged users to mount drives as if they were using sudo, even without an entry in /etc/fstab. This is perfect for computers that have users without RootSudo access, like public terminals or thin clients.

pmount can be used with the same syntax as mount (but without sudo), or quite simply as follows:

pmount <device> [ label ] 

Example:

  •  pmount /dev/sdb1 flash_drive

    This will mount the device /dev/sdb1 at /media/flash_drive.

If you leave off the label option, it will mount by default at /media/device.

To unmount the device, use pumount, like so:

pumount <device>

Example:

  •  pumount /dev/sdb1

For more help, see the man pages for pmount and pumount.

The Importance of Unmounting

IconsPage/tip.png

Before disconnecting devices, you must unmount them first. This is similar to «Safely Remove» in Windows in that the device won’t unmount until data is finished being written to the device, or until other programs are finished using it. This applies to all types of storage devices, including flash drives, flash cards, external hard drives, ipods and other media players, and even remote storage like Samba or NFS shares.

Failure to unmount before disconnecting the device can result in loss of data and/or a corrupted file system. There are no exceptions to this rule. Be safe — unmount your drives before disconnecting them!

Other Useful Commands

To see a list of your USB devices (the vendor and device ID’s), run:

lsusb

To see all attached storage devices and their partitions, run:

sudo fdisk -l

To see information about currently mounted systems, simply run:

mount

Troubleshooting

Presented here are some common problems users encounter.

Interfering services

Two services/programs responsible for automounting might interfere and thereby prevent a successful automount and permission setting.

Example: Activating the Automount function of Nautilus while using pmount will result in read-only permissions for normal users. Either disable Nautilus’ Automount function or deinstall pmount.

Unclean LogFile

If you are mounting drives formatted with NTFS (like most external USB hard disks are), you must first have the ntfs-3g driver installed. This is done automatically in newer versions of Ubuntu. You should also install ntfs-config and enable mounting, which is not done automatically. For ntfs-3g and ntfs-config, see MountingWindowsPartitions.

When a drive is not Safely Removed from a Windows machine (or a forced shutdown occurs from Windows), you may get an error like this when you plug in your drive:

$LogFile indicates unclean shutdown (0, 0)
Failed to mount '/dev/sda1': Operation not supported
Mount is denied because NTFS is marked to be in use. Choose one action:

Choice 1: If you have Windows then disconnect the external devices by
clicking on the 'Safely Remove Hardware' icon in the Windows
taskbar then shutdown Windows cleanly.

Choice 2: If you don't have Windows then you can use the 'force' option for
your own responsibility. For example type on the command line:

mount -t ntfs-3g /dev/sda1 /media/sda1/ -o force

The best option is Choice 1, but you can force the mount by running Choice 2 with sudo. You must then manually unmount it from the terminal (you can’t right click the desktop icon):

sudo umount <mount_point>

After that the drive should automount normally again.

User Privileges

If your usb device doesn’t appear on your desktop, you should check that your user has the correct privileges. Go to System->Administration->User and Groups, choose the user, click on «Properties», then 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.

NOTE: This does not seem to apply to Hardy Heron.

USB 2 Issues

old kernels workaround

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 plugging in your device.

recent kernels workaround, from Karmic

see also AbsolutelyTech

ehci_hcd is now built into the kernel and cannot be load/unloaded using modprobe. To revert a connected device from (failing) high-speed to full-speed:

  • Determine your device id using
     lsusb

  • Find which bus it is connected to. The bus id can be found as a folder in /sys/bus/pci/drivers/ehci_hcd. The following script explores buses and connected devices:
    pushd /sys/bus/pci/drivers/ehci_hcd > /dev/null
    for bus in 0000:??:??.? ; do
            echo "ehci_hcd bus $bus"
            pushd $bus/usb1 > /dev/null
            for dev in ?-?; do
                    idVendor=`cat $dev/idVendor`
                    idProduct=`cat $dev/idProduct`
                    echo "ehci_hcd bus $bus: device $dev = $idVendor:$idProduct"
            done
            popd > /dev/null
    done
    popd > /dev/null

    The information is also usually available in /var/log/kern.log

  • Unbind the bus (and all devices) from the ehci_hcd driver. Insert the bus id in the following command, using the format 0000:00:xx.x
     sudo sh -c 'echo -n "0000:00:xx.x" > unbind'

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 IDs 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 suddenly becomes read-only

If your device changes suddenly to read-only mode, and you see this 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. Or use «Disk Utility» (under System, Administration), find your device, unmount it, check the file system, then mount it again.

USB-Device is or becomes read-only without errors

If you see «Write Protect is off» and no errors in your logfiles, than you should set filesystem type specific mount options (FS_MOUNTOPTIONS) in /etc/usbmount/usbmount.conf. Wrong gid causes mounting read only.

General tip

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

dmesg

Check the latest messages; they should be related to your problem.

Seeking Further Help

The best place to get help with almost any Ubuntu problem is on the Ubuntu Forums. The Absolute Beginner Talk section is best for beginners.

Other Resources

IconsPage/resources.png

Some other related material:

  • RenameUSBDrive

  • BootFromUSB

  • UsbDriveDoSomethingHowto

  • http://en.wikipedia.org/wiki/USB_flash_drive

  • DebuggingUSBStorage


CategoryHardware CategoryUsb

Понравилась статья? Поделить с друзьями:
  • The forest как найти кабину самолета
  • Как составить договор передачи квартиры в собственность
  • Как исправить дырку на рубашке
  • Котел аристон ошибка 5р2 как исправить
  • Как составить бизнес план для ремонта квартир