LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-03-2010, 10:15 AM   #1
snydergc
LQ Newbie
 
Registered: Jan 2010
Posts: 5

Rep: Reputation: 1
Commands to work with USB drives


When working in command mode, what are some commands to use to query a USB drive? How do I look for it's "name" if I don't know it? I know once I find it and can use it normal cd and ls commands would work. It's just finding the drive, maybe mounting it, etc.
 
Old 08-03-2010, 10:27 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387
Hi,

The dmesg command shows this information.

After I plug in the usb device I see something like this:
Quote:
dmesg | tail -25
usb 1-1: new high speed USB device using ehci_hcd and address 7
usb 1-1: configuration #1 chosen from 1 choice
scsi4 : SCSI emulation for USB Mass Storage devices
usb-storage: device found at 7
usb-storage: waiting for device to settle before scanning
scsi 4:0:0:0: Direct-Access Kingston DT Secure 6.52 PQ: 0 ANSI: 0 CCS
sd 4:0:0:0: [sdd] 1975295 512-byte hardware sectors (1011 MB)
sd 4:0:0:0: [sdd] Write Protect is off
sd 4:0:0:0: [sdd] Mode Sense: 45 00 00 08
sd 4:0:0:0: [sdd] Assuming drive cache: write through
sd 4:0:0:0: [sdd] 1975295 512-byte hardware sectors (1011 MB)
sd 4:0:0:0: [sdd] Write Protect is off
sd 4:0:0:0: [sdd] Mode Sense: 45 00 00 08
sd 4:0:0:0: [sdd] Assuming drive cache: write through
sdd: sdd1
sd 4:0:0:0: [sdd] Attached SCSI removable disk
sd 4:0:0:0: Attached scsi generic sg5 type 0
usb-storage: device scan complete
The 2 bold parts are of interest.
- The first shows me that the (raw) usb device is attached to /dev/sdd.
- The second shows me that this particular usb device has 1 partition (/dev/sdd1).

You can mount it now as follows (assuming the filesystem on it is ext3):
mount -t ext3 /dev/sdd1 /mnt/mymountpoint

Unmounting is done as follows:
umount /dev/sdd1

the df -h command shows what is mounted.

Hope this helps.
 
Old 08-03-2010, 10:59 AM   #3
francp
LQ Newbie
 
Registered: Mar 2010
Posts: 3

Rep: Reputation: 0
Use the command

"lsusb"

hope it helps
 
Old 08-03-2010, 11:18 AM   #4
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387
Hi,

@francp: Yep, nice command. But I've seen more then one distro that does not install the lsusb command by default and you also need to be root to use it. Another downside is that it does not show the device (as in /dev/xyz), which is needed if you want to mount it.

The command is generally used for displaying information about USB buses in the system and the devices connected to them.

Hope this clears things up a bit.
 
Old 08-03-2010, 01:22 PM   #5
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
The blkid command is useful if the USB device is a block device which many are.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Will external USB drives just "work"? mfoley Linux - Hardware 3 04-09-2009 02:31 AM
Any problems with USB-port PCMCIA cards and USB Floppy Drives? DreameR-X Linux - Laptop and Netbook 9 05-14-2005 02:37 PM
Do portable usb drives work with linux? M$ISBS Linux - Hardware 4 04-17-2005 02:05 AM
udev, USB Flash Drives, and usb-mount talkingwires Debian 13 11-07-2004 01:15 PM
Give user permission to mount/use cdrom drives or usb drives zwyrbla Linux - Newbie 2 08-23-2004 05:30 PM


All times are GMT -5. The time now is 12:50 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration