How to Mount a USB Drive in Ubuntu

Mounting a USB Drive in Ubuntu‘s CLI

Mounting USB (Flash) disks and external hard drives on Ubuntu is easy – this is how you do it from the command line. You can also script the mount operation if you need backups to be moved to an external drive.

  1. sudo fdisk -l (to find the USB device)
  2. sudo mkdir /media/usb_key (creating the “to-mount” folder)
  3. sudo mount /dev/sdg1 /media/usb_key (perform the mount)
  4. ls -lah /media/usb_key (look at the drive contents)
  5. sudo umount /media/usb_key (when you are done using)

After the first command the USB device definition will appear towards the end of the list.

Fnding the USB Disk


Disk /dev/sdg: 7.5 GiB, 8054112256 bytes, 15730688 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x04dd5721

Device Boot Start End Sectors Size Id Type
/dev/sdg1 63 15730687 15730625 7.5G c W95 FAT32 (LBA)

 

The device ID in this case is /dev/sdg1 which is used in the mount and unmount commands.

Leave a Reply

Your email address will not be published. Required fields are marked *