Jun 302008
 


USB devices will be detected automatically on your openSUSE or SUSE linux Destop or Server and mounted. But, if it isn’t mounted then you in an unusual instance then you end up tracing the device path and mounting it manaully.

To find the device path, there are two easy ways, one using “dmesg” and the other is using the /proc filesystem.

Using DMESG

dmesg helps users to print the bootup messages on your Server PC or Laptop. Simply, run the dmesg command and look for the USB device entries in the messages as soon as you have attached the USB device to the system. You should find something like the following:

linux-i343:/ # dmesg | more


..
scsi5 : SCSI emulation for USB Mass Storage devices
usb 1-1: New USB device found, idVendor=0930, idProduct=6533
usb 1-1: New USB device strings: Mfr=0, Product=2, SerialNumber=3
usb 1-1: Product: USB Flash Memory
usb 1-1: SerialNumber: 0C506651721289B4
usb-storage: device found at 4
usb-storage: waiting for device to settle before scanning
scsi 5:0:0:0: Direct-Access              USB Flash Memory 1.04 PQ: 0 ANSI: 0 CCS
sd 5:0:0:0: [sdb] 1001472 512-byte hardware sectors (513 MB)
sd 5:0:0:0: [sdb] Write Protect is off
sd 5:0:0:0: [sdb] Mode Sense: 23 00 00 00
sd 5:0:0:0: [sdb] Assuming drive cache: write through
sd 5:0:0:0: [sdb] 1001472 512-byte hardware sectors (513 MB)
sd 5:0:0:0: [sdb] Write Protect is off
sd 5:0:0:0: [sdb] Mode Sense: 23 00 00 00
sd 5:0:0:0: [sdb] Assuming drive cache: write through
sdb: sdb1
sd 5:0:0:0: [sdb] Attached SCSI removable disk
sd 5:0:0:0: Attached scsi generic sg2 type 0
usb-storage: device scan complete

..
..

In the above, you can find that the device is labelled as “sdb1″ and hence the device path will be

/dev/sdb1

To mount the device simply use the mount command as follows:

linux-i343:/ # mount /dev/sdb1 /media

Now, change directory to /mnt and you can find your files on the USB stick there.

linux-i343:/ # cd /mnt

linux-i343:/ # ls

Alternatively, there is an even more simple option. Before, you mount you attach the USB drive, check the /proc/partitions directory

linux-i343:/ # cat /proc/partitions
major minor  #blocks  name

8     0    8388608 sda
8     1      72261 sda1
8     2    8313637 sda2
253     0    2535424 dm-0
253     1    5242880 dm-1
253     2     532480 dm-2

Now, attach the USB disk and give it a few seconds. Now, check again:

linux-i343:/ # cat /proc/partitions
major minor  #blocks  name

8     0    8388608 sda
8     1      72261 sda1
8     2    8313637 sda2
253     0    2535424 dm-0
253     1    5242880 dm-1
253     2     532480 dm-2
8    16     500736 sdb
8    17     500720 sdb1

There you go, you can see the new device tree “sdb” under which you have “sdb1″. The device path will /dev/sdb1

Mount as earlier and you are ready to access your USB disk.

There may be more easier ways that one may know. If there is, please post a comment and I can update this article.