In a nutshell, the device I have is not a block device so blkid
command doesn't suit me. But at least I can get some info about my device via lsusb -v
command although it doesn't contain its UUID.
And I know my device does have UUID. The thing is I tried to run VBoxManage list usbhost
command and it showed me some USB devices (including non-block devices) with their UUIDs. But for some reason the output of the command abruptly ceased (even without trailing newline symbol, although with 0 return code) in the beginning of the list so I didn't have a chance to see my device's UUID. I do not want to endevour finding out why it happened. Instead I want to know an alternate way to find out UUID of my device because I believe it should be easier to do.
And just in the case this information is interesting to someone:
Gentoo, linux 3.7.10
/sys/kernel/debug/usb/devices
T: Bus=02 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=480 MxCh= 2
B: Alloc= 0/800 us ( 0%), #Int= 1, #Iso= 0
D: Ver= 2.00 Cls=09(hub ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
P: Vendor=1d6b ProdID=0002 Rev= 3.07
S: Manufacturer=Linux 3.7.10-gentoo-r1 ehci_hcd
S: Product=EHCI Host Controller
S: SerialNumber=0000:00:1d.0
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr= 0mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub
E: Ad=81(I) Atr=03(Int.) MxPS= 4 Ivl=256ms
T: Bus=02 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=480 MxCh= 8
D: Ver= 2.00 Cls=09(hub ) Sub=00 Prot=01 MxPS=64 #Cfgs= 1
P: Vendor=8087 ProdID=0024 Rev= 0.00
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr= 0mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub
E: Ad=81(I) Atr=03(Int.) MxPS= 2 Ivl=256ms
T: Bus=02 Lev=02 Prnt=02 Port=02 Cnt=01 Dev#= 3 Spd=480 MxCh= 0
D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
P: Vendor=048d ProdID=1336 Rev= 1.00
S: Manufacturer=Generic
S: Product=Mass Storage Device
S: SerialNumber=00000000000006
C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=100mA
I:* If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=125us
E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
T: Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=480 MxCh= 2
B: Alloc= 0/800 us ( 0%), #Int= 4, #Iso= 0
D: Ver= 2.00 Cls=09(hub ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
P: Vendor=1d6b ProdID=0002 Rev= 3.07
S: Manufacturer=Linux 3.7.10-gentoo-r1 ehci_hcd
S: Product=EHCI Host Controller
S: SerialNumber=0000:00:1a.0
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr= 0mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub
E: Ad=81(I) Atr=03(Int.) MxPS= 4 Ivl=256ms
T: Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 2 Spd=480 MxCh= 6
D: Ver= 2.00 Cls=09(hub ) Sub=00 Prot=01 MxPS=64 #Cfgs= 1
P: Vendor=8087 ProdID=0024 Rev= 0.00
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr= 0mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub
E: Ad=81(I) Atr=03(Int.) MxPS= 1 Ivl=256ms
T: Bus=01 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#= 3 Spd=12 MxCh= 0
D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
P: Vendor=1366 ProdID=0101 Rev= 1.00
S: Manufacturer=SEGGER
S: Product=J-Link
S: SerialNumber=000038000375
C:* #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr=100mA
I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
E: Ad=81(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms
E: Ad=02(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms
T: Bus=01 Lev=02 Prnt=02 Port=03 Cnt=02 Dev#= 4 Spd=12 MxCh= 0
D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
P: Vendor=0403 ProdID=6001 Rev= 6.00
S: Manufacturer=FTDI
S: Product=TTL232R-3V3
S: SerialNumber=FTF5T2QJ
C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr= 90mA
I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=ftdi_sio
E: Ad=81(I) Atr=02(Bulk) MxPS= 64 Ivl=0ms
E: Ad=02(O) Atr=02(Bulk) MxPS= 64 Ivl=0ms
T: Bus=01 Lev=02 Prnt=02 Port=04 Cnt=03 Dev#= 5 Spd=12 MxCh= 0
D: Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
P: Vendor=046d ProdID=0a01 Rev=10.13
S: Manufacturer=Logitech
S: Product=Logitech USB Headset
C:* #Ifs= 3 Cfg#= 1 Atr=80 MxPwr=100mA
I:* If#= 0 Alt= 0 #EPs= 0 Cls=01(audio) Sub=01 Prot=00 Driver=(none)
I:* If#= 1 Alt= 0 #EPs= 0 Cls=01(audio) Sub=02 Prot=00 Driver=(none)
I: If#= 1 Alt= 1 #EPs= 1 Cls=01(audio) Sub=02 Prot=00 Driver=(none)
E: Ad=01(O) Atr=09(Isoc) MxPS= 192 Ivl=1ms
I: If#= 1 Alt= 2 #EPs= 1 Cls=01(audio) Sub=02 Prot=00 Driver=(none)
E: Ad=01(O) Atr=09(Isoc) MxPS= 96 Ivl=1ms
I:* If#= 2 Alt= 0 #EPs= 0 Cls=01(audio) Sub=02 Prot=00 Driver=(none)
I: If#= 2 Alt= 1 #EPs= 1 Cls=01(audio) Sub=02 Prot=00 Driver=(none)
E: Ad=84(I) Atr=09(Isoc) MxPS= 96 Ivl=1ms
T: Bus=01 Lev=02 Prnt=02 Port=05 Cnt=04 Dev#= 6 Spd=480 MxCh= 7
D: Ver= 2.00 Cls=09(hub ) Sub=00 Prot=01 MxPS=64 #Cfgs= 1
P: Vendor=2001 ProdID=f103 Rev= 1.00
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr= 0mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub
E: Ad=81(I) Atr=03(Int.) MxPS= 1 Ivl=256ms
T: Bus=01 Lev=03 Prnt=06 Port=01 Cnt=01 Dev#= 7 Spd=480 MxCh= 0
D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
P: Vendor=13fe ProdID=3600 Rev= 1.00
S: Manufacturer=
S: Product=
S: SerialNumber=90B217007BC11098
C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=200mA
I:* If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
T: Bus=01 Lev=03 Prnt=06 Port=03 Cnt=02 Dev#= 12 Spd=1.5 MxCh= 0
D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs= 1
P: Vendor=045e ProdID=071d Rev= 2.50
S: Manufacturer=Microsoft
S: Product=Microsoft�� 2.4GHz Transceiver V1.0
C:* #Ifs= 2 Cfg#= 1 Atr=a0 MxPwr=100mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=01 Prot=01 Driver=usbhid
E: Ad=81(I) Atr=03(Int.) MxPS= 8 Ivl=10ms
I:* If#= 1 Alt= 0 #EPs= 1 Cls=03(HID ) Sub=00 Prot=00 Driver=usbhid
E: Ad=82(I) Atr=03(Int.) MxPS= 8 Ivl=10ms
The device of interest is:
T: Bus=01 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#= 3 Spd=12 MxCh= 0
UUIDs of existing non-block devices:
[krokoziabla@ktulhu]:0:/home/krokoziabla> VBoxManage list usbhost
Host USB Devices:
UUID: f864c487-2a25-4649-84cd-39dc67be695a
VendorId: 0x0403 (0403)
ProductId: 0x6001 (6001)
Revision: 6.0 (0600)
Port: 3
USB version/speed: 2/1
Manufacturer: FTDI
Product: TTL232R-3V3
SerialNumber: FTF5T2QJ
Address: sysfs:/sys/devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.4//device:/dev/vboxusb/001/004
Current State: Busy
UUID: b03a6680-ecc5-4f48-8103-3e387cf4cb28
VendorId: 0x045e (045E)
ProductId: 0x071d (071D)
Revision: 2.80 (0280)
Port: 3
USB version/speed: 2/1
Manufacturer: Microsoft
Product: Microsoft[krokoziabla@ktulhu]:0:/home/krokoziabla>
Best Answer
Devices do not have UUIDs. Partitions do. UUIDs are created when a filesystem is formatted. This is why they can be changed, and why they do change when you reformat.
In other words, a UUID is not a characteristic of piece of hardware, and there is no way to "find" information that does not exist.
There may be one or more partitions on the device that have UUIDs, so if you have seen one before associated with it, it's the UUID of a partition. If there is more than one partition, there may be a UUID for each one (there also may not, since none are required), but none of them are characteristics of the hardware (they're just mutable pieces of data stored on it). USB keys usually come with one big pre-formatted FAT32 or NTFS partition. If you reformat this, the UUID will change.
To find the UUID of a partition, you do need to find its identity as a block device.
cat /proc/partitions
should list everything the kernel is aware of, mounted or not. Presuming there aren't dozens of drives attached to your system, it should be simple enough to figure out which one is the USB./proc/partitions
actually lists the drive too, you can tell this apart from its partitions because the drive won't have a number at the end (sda vs. sda1), andfile -s
output will be different:Sometimes the preformatted drives are just one big device, eg:
Notice this one is in fact "unlabelled" and appears to have no UUID (they are not mandatory).