Saturday, October 14, 2017

Detect and mount devices

Solution 1: Try the Disks program (if you run Ubuntu with a GUI).
(check that the gnome-disk-utility package is installed) (make sure that udisk2 package is installed)
Hit SUPERA to open the Application Lens and type Disks in the Search Applications field.
(SUPER is probably the key with the Windows icon.)
In Disks you can play with the automount options.
For example:
Disks Program
You have to click on the little icon with the two gears and choose 'Edit Mount Options'.
Mount Options
Solution 2: Using the CLI (for a headless installation)
Step 1. Check the blockdevices and the file systems that are assigned to those block devices.
lsblk
lsblk
Here you see the blokdevice sdb with partition /sdb1. But it's not mounted. There's no file assigned to it.
Step 2. What kind of device is sdb?
sudo lshw 
or
sudo lshw | less
lshw
So the USB stick - the block device /sdb - has the logical name /dev/sdb. And the FAT32 filesystem on that stick has the logical name /dev/sdb1.
Step 3. Mounting the USB-stick
We will mount /dev/sdb1 to /media/usbstick
sudo mkdir /media/usbstick

sudo mount -t vfat /dev/sdb1 /media/usbstick 
Read the manpage of mount for other options.
Step 4. Did it work?
lsblk
lsblk 2
Yes, we can see that the filesystem on the USB stick is mounted to /media/usbstick
Addendum : if there are no logical names like /dev/sdb, you should first create them. See this information about setting up and controling loop devices with the losetup command

No comments:

Post a Comment