Mount a USB device

Most Linux distributions automatically recognize and mount removable USB drives. Ubuntu, for example, automatically mounts a USB device to the /media/USERNAME/ directory. However, you can still find some older distributions that require external USB devices to be manually mounted before they can be used.

In this lesson we will describe the steps required to mount an external USB drive manually.

First, plug in your USB device. To find out what name your device has, run the fdisk -l command:

linux fdisk l option

You can also get the information on the name of the USB device by looking at the /var/log/messages file. The last few last usually contain information about the plugged device, like in this example:

linux var log messages

In the example above, we can see that our USB device has been listed as /dev/sdd1.

Second, we need to create an empty directory where we will mount our device (/usb_device in this case). Next, we need to run the mount command:

linux mount usb

Now we can access data on our USB device.

To unmount the device, we can use the following command:

linux umount usb

To permanently mount our USB device, we can add an entry to the /etc/fstab file. For example, we could add the following line:

linux automatically mount usb fstab

The line above specifies that the device listed as /dev/sdd1 will be mounted on /usb_device, and the file system type will be automatically recognized by the kernel. The mount, dump and fsck options are also specified.

Subscribe to our Newsletter

Like us on Facebook

Geek University 2019