Condition: find reliably device name where disk label (MasiWeek) and disk size (2 TB) are known
Motivation: trying to determine what Ubuntu's GUI button mount does
Characteristics of the system
Disk label is the name of the disc given by the user. It is listed in
/media/masi/if mounted correctly.Command
lsblk -no name,label,partlabelgivessda ├─sda1 ├─sda2 └─sda3 sdb └─sdb1 MasiWeekI know the disk label is
MasiWeekand its size is 2 TB, visible in the command as 1.8T. I want to find reliably such a disc such that I can do the following where I need the info for the variable$label# https://askubuntu.com/a/593375/25388 partition=$(basename $(readlink $label)) sudo mkdir /media/$USER/$label sudo mount /dev/$partition /media/$USER/$label
System: Linux Ubuntu 16.04 64 bit
Related: What is the Equivalent Command to Ubuntu's GUI “Mount”?
man udisksctland read the instructions there (it's what your "gui button" does underneath, to answer both questions).gvfs-mountcommand: you can rungvfs-mount --list --detailand look for theunix-devicefield, and mount it (as user, not root) with something likegvfs-mount -d /dev/sdbmountalready understands bothLABEL=nameandUUID=uuidarguments as well as the/dev/xxxxarg. It also has-Land-Uoptions. So, just usemount LABEL=MasiWeek /media/masi/MasiWeekormount -L MasiWeek /media/masi/MasiWeek