Mounting an external USB Flash/Thumb /Hard Drive

By | August 3, 2016

When you plug a USB thumb drive into a modern Linux system it is automatically mounted onto the disk (file system) and appears on the desktop depending on the distribution (distro) youre using. But there might be some situations that prevents a an external file system (like in an external thumb drive or hard disk) from being mounted like in a situation when accessing a Linux server from the command line without GUI utilities. Whatever the case we would doing some manual mounting in the steps that follow.

STEP 1

Login as root (or use sudo) or switch to root using the su command

 

STEP 2

Plug in the USB memory device: to check if the USB memory device is present, it would appear as a directory named something like usb-storage-0 under the /proc/scsi directory (i.e. /proc/scsi/usb-storage-0). If this /proc/bus directory does not exist or is not found in your system then you have to recompile your kernel or update it. Another way to check if the usb device is present is to type the following command;

less /proc/scsi/usb-storage/2

This would open a file in that location and if the last line entry is yes it means the device is plugged in, if No then it is not plugged in. You can remove the device and repeat STEP 2.

STEP 3
After successfully plugging the USB device and being recognized by the system. Use the dmesg command to see what name is assigned by the system to the device. It should be in the form of sda1 or sdb1, this is what you would use when mounting (mine is sdb1 here)

STEP 4
Create a mount point directory usually inside the mnt directory.

mkdir –m 777 /mnt/my_usb_flash

STEP 5

You can name it whatever you want or can remember, Im using my_usb_fash.

Then you can now mount the usb memory drive to the mount point directory you created in step 4.

mount –t vfat /dev/sdb1 /mnt/my_usb_flash

If successful, to see files on the usb enter;

cd /mnt/my_usb-flash

And then;

ls –a

Or simply use the following command to list the files and directory on the connected drive;

ls –al /mnt/my_usb_flash

Then you done.

Happy Linux’NG!


NEVER MISS AN UPDATE




I agree to have my personal information transfered to MailChimp ( more information )

Join over 10,000 visitors to receive Open Source tips, trick, news, tutorials, programming and more.

We hate spam. Your email address will not be sold or shared with anyone else.

ALEXANDER OMOROKUNWA
MUST READ  How to Create Files And Directories With Passwords in Linux [VIDEO]

Tell us what you think