How to mount a drive in Linux


Mount that drive

You just got a brand new shiny USB stick for moving things around your devices fast and easy but your NAS or home server does not see the newly plugged in device. In this tutorial, you will learn how to mount it as folder in the linux OS using the console commands.

Find the drive
Run the following command to display the attached disks:

fdisk -l

The output should look similar to this:

The disk is /dev/sdg1 and the format is FAT32.

Create the mount folder
Creating a folder where the USB device to be mounted is imperative so let’s create one:

 mkdir /media/myusb

This is where the contents of the USB stick will be present.
Mount the USB
Mounting is a simple command:

 mount /dev/sdg1 /media/myusb

If no errors are shown, the command was successfull.
To check , simply check the mounted folders:

 df -h

The path /media/myusb should be shown.

Access the mounted drive
To access the drive, go to the mounted path and list the contents:

 cd /media/myusb 

The content of the drive should be shown.

Unmounting the drive
In order make a safe removal of the drive, unmount it before physical removal:

 umount /dev/sdg1


Recent Posts