본문 바로가기
프로그래밍/기타

[Linux, Ubuntu] USB 메모릭 스틱/장치 ID, 마운트 위치 알아내기

by GhostWeb 2021. 5. 9.
반응형

○ USB 장치 ID, 정보 알아내기 (lsusb)

- 버추얼 박스 우분투에 USB 메모리 스틱을 인식한 모습 (SanDisk Corp. Cruzer Force (64GB))

ubuntu@ubuntu-VirtualBox:~$ lsusb
Bus 001 Device 003: ID 0781:557d SanDisk Corp. Cruzer Force (64GB)
Bus 001 Device 002: ID 80ee:0021 VirtualBox USB Tablet
Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

 

- lsusb 사용법

ubuntu@ubuntu-VirtualBox:~$ lsusb --help
Usage: lsusb [options]...
List USB devices
  -v, --verbose
      Increase verbosity (show descriptors)
  -s [[bus]:][devnum]
      Show only devices with specified device and/or
      bus numbers (in decimal)
  -d vendor:[product]
      Show only devices with the specified vendor and
      product ID numbers (in hexadecimal)
  -D device
      Selects which device lsusb will examine
  -t, --tree
      Dump the physical USB device hierarchy as a tree
  -V, --version
      Show version of program
  -h, --help
      Show usage and help

○ USB 마운트된 위치 보기

- lsblk를 명령어를 입력하면 현재 시스템에 마운트된 디스크 정보를 볼 수 있어요.

- MOUNTPOINT 경로로 USB 메모리 스틱에 있는 파일, 폴더 등에 접근할 수 있어요.

 

sdb      8:16   1  14.3G  0 disk 
└─sdb1   8:17   1  14.3G  0 part /media/ubuntu/57ED-DBC8

ubuntu@ubuntu-VirtualBox:~$ lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
loop0    7:0    0  55.5M  1 loop /snap/core18/1988
loop1    7:1    0  55.5M  1 loop /snap/core18/1997
loop2    7:2    0 255.6M  1 loop /snap/gnome-3-34-1804/36
loop3    7:3    0   219M  1 loop /snap/gnome-3-34-1804/66
loop4    7:4    0  64.8M  1 loop /snap/gtk-common-themes/1514
loop5    7:5    0    51M  1 loop /snap/snap-store/518
loop6    7:6    0  32.3M  1 loop /snap/snapd/11402
loop7    7:7    0  49.8M  1 loop /snap/snap-store/467
loop8    7:8    0  32.3M  1 loop /snap/snapd/11588
loop9    7:9    0 295.3M  1 loop /snap/vlc/2103
loop10   7:10   0  65.1M  1 loop /snap/gtk-common-themes/1515
sda      8:0    0    70G  0 disk 
├─sda1   8:1    0   512M  0 part /boot/efi
├─sda2   8:2    0     1K  0 part 
└─sda5   8:5    0  69.5G  0 part /
sdb      8:16   1  14.3G  0 disk 
└─sdb1   8:17   1  14.3G  0 part /media/ubuntu/57ED-DBC8
sr0     11:0    1  58.2M  0 rom  /media/ubuntu/VBox_GAs_6.1.14

 

- 각 장치의 타입 보는 방법 (sata, usb 등)

ubuntu@ubuntu-VirtualBox:~$ lsblk -So NAME,TRAN
NAME TRAN
sda  sata
sdb  usb
sr0  ata

 

- USB 타입의 장치만 보는 방법

lsblk -So NAME,TRAN | grep usb
sdb  usb

 

- lsblk 사용 방법

ubuntu@ubuntu-VirtualBox:~$ lsblk --help

Usage:
 lsblk [options] [<device> ...]

List information about block devices.

Options:
 -D, --discard        print discard capabilities
 -E, --dedup <column> de-duplicate output by <column>
 -I, --include <list> show only devices with specified major numbers
 -J, --json           use JSON output format
 -O, --output-all     output all columns
 -P, --pairs          use key="value" output format
 -S, --scsi           output info about SCSI devices
 -T, --tree[=<column>] use tree format output
 -a, --all            print all devices
 -b, --bytes          print SIZE in bytes rather than in human readable format
 -d, --nodeps         don't print slaves or holders
 -e, --exclude <list> exclude devices by major number (default: RAM disks)
 -f, --fs             output info about filesystems
 -i, --ascii          use ascii characters only
 -l, --list           use list format output
 -M, --merge          group parents of sub-trees (usable for RAIDs, Multi-path)
 -m, --perms          output info about permissions
 -n, --noheadings     don't print headings
 -o, --output <list>  output columns
 -p, --paths          print complete device path
 -r, --raw            use raw output format
 -s, --inverse        inverse dependencies
 -t, --topology       output info about topology
 -z, --zoned          print zone model
 -x, --sort <column>  sort output by <column>
     --sysroot <dir>  use specified directory as system root

 -h, --help           display this help
 -V, --version        display version

Available output columns:
        NAME  device name
       KNAME  internal kernel device name
        PATH  path to the device node
     MAJ:MIN  major:minor device number
     FSAVAIL  filesystem size available
      FSSIZE  filesystem size
      FSTYPE  filesystem type
      FSUSED  filesystem size used
      FSUSE%  filesystem use percentage
  MOUNTPOINT  where the device is mounted
       LABEL  filesystem LABEL
        UUID  filesystem UUID
      PTUUID  partition table identifier (usually UUID)
      PTTYPE  partition table type
    PARTTYPE  partition type UUID
   PARTLABEL  partition LABEL
    PARTUUID  partition UUID
   PARTFLAGS  partition flags
          RA  read-ahead of the device
          RO  read-only device
          RM  removable device
     HOTPLUG  removable or hotplug device (usb, pcmcia, ...)
       MODEL  device identifier
      SERIAL  disk serial number
        SIZE  size of the device
       STATE  state of the device
       OWNER  user name
       GROUP  group name
        MODE  device node permissions
   ALIGNMENT  alignment offset
      MIN-IO  minimum I/O size
      OPT-IO  optimal I/O size
     PHY-SEC  physical sector size
     LOG-SEC  logical sector size
        ROTA  rotational device
       SCHED  I/O scheduler name
     RQ-SIZE  request queue size
        TYPE  device type
    DISC-ALN  discard alignment offset
   DISC-GRAN  discard granularity
    DISC-MAX  discard max bytes
   DISC-ZERO  discard zeroes data
       WSAME  write same max bytes
         WWN  unique storage identifier
        RAND  adds randomness
      PKNAME  internal parent kernel device name
        HCTL  Host:Channel:Target:Lun for SCSI
        TRAN  device transport type
  SUBSYSTEMS  de-duplicated chain of subsystems
         REV  device revision
      VENDOR  device vendor
       ZONED  zone model
반응형