I'm trying to write a script that make a list of connected USBs list like this:
But I don't know how to identify the connected USB device is a storage one, and the volume name of it.
C/C++, Python, or Node.js help are welcome, and only under Linux OS.
I'm looking to mount and remount using code, but I think It will be easy to use Linux commands for this.
Give this a shot:
udevadm info -a -n /dev/usbdevice
Further info:
udevinfo -q all -n /dev/sda
Still further info:
lsusb -v
lshw
Use the command blkid(8)
to identify UUID, filesystem type, volume label, etc of your visible/formatted partitions in your system. It's used by the system scripts to collect information and mount filesystems, so you will have no problems in parsing its output.
如果已经挂载并且是您可以看到的以下任何类型的分区:
mount -l|grep -E 'fuseblk|vfat|ext4'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.