Friday, April 25, 2008

Read usb pen drive on ubuntu server

Insert pen drive and cehck the file below to see how the USB stick is being recognized:

sudo vi /var/log/messages

Apr 25 17:46:29 lmnuknet03 kernel: [19465.773928] usb 4-5: new high speed USB device using ehci_hcd and address 2
Apr 25 17:46:29 lmnuknet03 kernel: [19465.927909] usb 4-5: configuration #1 chosen from 1 choice
Apr 25 17:46:29 lmnuknet03 kernel: [19465.993713] usbcore: registered new interface driver libusual
Apr 25 17:46:29 lmnuknet03 kernel: [19466.008173] Initializing USB Mass Storage driver...
Apr 25 17:46:29 lmnuknet03 kernel: [19466.010379] scsi4 : SCSI emulation for USB Mass Storage devices
Apr 25 17:46:29 lmnuknet03 kernel: [19466.011834] usbcore: registered new interface driver usb-storage
Apr 25 17:46:29 lmnuknet03 kernel: [19466.011843] USB Mass Storage support registered.
Apr 25 17:46:34 lmnuknet03 kernel: [19470.992039] scsi 4:0:0:0: Direct-Access Kingston DataTraveler 2.0 PMAP PQ: 0 ANSI: 0 CCS
Apr 25 17:46:35 lmnuknet03 kernel: [19471.530326] sd 4:0:0:0: [sdb] 977664 512-byte hardware sectors (501 MB)
Apr 25 17:46:35 lmnuknet03 kernel: [19471.531203] sd 4:0:0:0: [sdb] Write Protect is off
Apr 25 17:46:35 lmnuknet03 kernel: [19471.533813] sd 4:0:0:0: [sdb] 977664 512-byte hardware sectors (501 MB)
Apr 25 17:46:35 lmnuknet03 kernel: [19471.534442] sd 4:0:0:0: [sdb] Write Protect is off
Apr 25 17:46:35 lmnuknet03 kernel: [19471.534473] sdb: sdb1
Apr 25 17:46:35 lmnuknet03 kernel: [19471.535263] sd 4:0:0:0: [sdb] Attached SCSI removable disk
Apr 25 17:46:35 lmnuknet03 kernel: [19471.535315] sd 4:0:0:0: Attached scsi generic sg2 type 0



Create a directory where to mount the drive. Example is:
$mkdir /tmp/pen

Mount the pen drive on the new directory:
$sudo mount /dev/sdb1 -t auto /tmp/pen

Access the files:
$cd /tmp/pen

2 comments:

Term Papers said...

Thanks ever so much, very useful article. Great information! Very smart, thanks for kindly sharing it with us. Very well done indeed

Fábio said...

Thanks A LOT!!!!!!!!!!!!!