Jun's Blog

Output, activities, memo and etc.

Fedora: How to detect and mount USB disks on commands

I learned how to detect and mount the USB disks on commands.

ask.fedoraproject.org

How to list up the not mounted USB disks.

The 2 commands below are useful.

$ lsblk -r -p -o NAME,TYPE,FSTYPE,UUID,SIZE,LABEL | grep -v "^/dev/loop"
NAME TYPE FSTYPE UUID SIZE LABEL
/dev/sda disk   232.9G 
/dev/sda1 part vfat XXXX-XXXX 232.9G 
...
$ gio mount -l
Drive(0): WD_BLACK  SN750 2TB
  Type: GProxyDrive (GProxyVolumeMonitorUDisks2)
Drive(1): USB DISK 3.2
  Type: GProxyDrive (GProxyVolumeMonitorUDisks2)
  Volume(0): 250 GB Volume
    Type: GProxyVolume (GProxyVolumeMonitorUDisks2)

How to mount a disk

$ udisksctl mount -b /dev/sda1
Mounted /dev/sda1 at /run/media/jaruga/XXXX-XXXX