How can I determine which /dev/sdX device my usb stick is plugged into?
I am running Ubuntu 9.04.
How can I determine which /dev/sdX device my usb stick is plugged into?
I am running Ubuntu 9.04.
You may want to use /dev/disk/by-id
or /dev/disk/by-uuid/
instead. These never change for a given device, whatever /dev/sdXX
your pluggable drives have.
Execute sudo blkid
: it will show block device names:
/dev/sdc1: UUID="004A31DB4A31CDE2" LABEL="WinGamer" TYPE="ntfs" /dev/sdd1: LABEL="0DAY" UUID="9b14c03b-7251-434f-bbb9-eac42b2db927" TYPE="ext2" /dev/sdg5: LABEL="QFAT" UUID="4257-E346" TYPE="vfat" /dev/sdg6: LABEL="BACKUP-HDD" UUID="fee45c66-11bd-49fa-a62a-4a541716e8e1" TYPE="ext2"
on a command line, do a ls /media
and you will usually see it.
e.g. on my system:
$ ls /media
cdrom cdrom0 cdrom1 floppy floppy0 LaCie
LaCie is my usb stick
failing that try
$ lsusb
on my system
$ lsusb
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
...
Bus 001 Device 004: ID 059f:1028 LaCie, Ltd
...
If it shows up there but not in /media, you will need to figure out mounting, or ask another question..
Finally, I can type "mount" and look through the output for your answer, or in my case:
$ mount | grep LaCie
/dev/sdb on /media/LaCie type vfat (rw,nosuid,nodev,uhelper=hal,shortname=mixed,uid=1000,utf8,umask=077,flush)
It will depend. Type dmesg
at the console and the output should show the USB stick being mounted.
Here is some example output:
[ 2699.328853] Initializing USB Mass Storage driver...
[ 2699.339045] scsi4 : SCSI emulation for USB Mass Storage devices
[ 2699.345916] usbcore: registered new interface driver usb-storage
[ 2699.345922] USB Mass Storage support registered.
[ 2699.350764] usb-storage: device found at 3
[ 2699.350767] usb-storage: waiting for device to settle before scanning
[ 2704.353322] usb-storage: device scan complete
[ 2704.354353] scsi 4:0:0:0: Direct-Access USB DISK 2.0 0403 PQ: 0 ANSI: 0 CCS
[ 2704.374592] sd 4:0:0:0: [sdb] 3981312 512-byte hardware sectors: (2.03 GB/1.89 GiB)
[ 2704.415233] sd 4:0:0:0: [sdb] Write Protect is off
[ 2704.415239] sd 4:0:0:0: [sdb] Mode Sense: 43 00 00 00
[ 2704.415242] sd 4:0:0:0: [sdb] Assuming drive cache: write through
[ 2704.418087] sd 4:0:0:0: [sdb] 3981312 512-byte hardware sectors: (2.03 GB/1.89 GiB)
[ 2704.419100] sd 4:0:0:0: [sdb] Write Protect is off
[ 2704.419105] sd 4:0:0:0: [sdb] Mode Sense: 43 00 00 00
[ 2704.419107] sd 4:0:0:0: [sdb] Assuming drive cache: write through
[ 2704.419114] sdb: sdb1
[ 2704.421024] sd 4:0:0:0: [sdb] Attached SCSI removable disk
[ 2704.421093] sd 4:0:0:0: Attached scsi generic sg2 type 0
In my case its the sdb
device that is assigned after I plug in a USB stick, since I have just the one internal hard drive in my laptop (sda).