2010-05-03 00:30:02     Using blkid, how to extract USB name?

Document created by Aaronwu Employee on Aug 21, 2013
Version 1Show Document
  • View in full screen mode

2010-05-03 00:30:02     Using blkid, how to extract USB name?

John Peter (INDIA)

Message: 89085   



  I have enabled hotplug in my kernel and is working. Now I need to extract the USB name .I have gone through the blkid documentation and I tried all the options with blkid. But I didnt get through. Below are some options I tried with blkid.


root:/> cat /proc/partitions

major minor  #blocks  name


  31        0        256 mtdblock0

  31        1        384 mtdblock1

  31        2       7552 mtdblock2

  31        3       7680 mtdblock3

  31        4        512 mtdblock4

   8        0    1974272 sda

root:/> blkid /dev/sda


root:/> blkid -h -t NAME=sda


root:/> lsusb

Bus 001 Device 003: ID 1307:0165 Transcend Information, Inc. 2GB/4GB Flash Drive

Bus 001 Device 002: ID 148f:2770 Ralink Technology, Corp.

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub


root:/> blkid |grep /dev/sda


root:/> blkid -p -o value -s TYPE /dev/sda



  For all these commands, I didnt get any output. Actually I have renamed my USB as DEMO and I want to extract this name by using blkid. So please throw some light on this.







2010-05-03 00:50:03     Re: Using blkid, how to extract USB name?

Mike Frysinger (UNITED STATES)

Message: 89086   


set the env var BLKID_DEBUG to 0xffff to see debugging output


otherwise, we dont have anything to do with blkid.  if you dont understand it or its documentation, you really should be asking the people who write it, not us.