Mount USB Drive in Linux | How to

To use an USB drive in Linux, just insert it into the USB drive slot on your PC. Usually a pop-up will appear and guide you. If it does not happen, type 'dmesg' command & locate your USB drive. The output should be something like this.

$ dmesg
...
...
USB Mass Storage Device Found /dev/sda1 ...
...

If you are unable to locate it in the above mentioned way, use the 'fdisk -l' command at the prompt. In addition the existing partitions, you will get some additional output as follows.

$ fdisk -l
...
...
Disk /dev/sda: 8036 MB, 8036285952 bytes
255 heads, 63 sectors/track, 977 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1         978     7847904    c  W95 FAT32 (LBA)
Partition 1 has different physical/logical endings:
     phys=(976, 254, 63) logical=(977, 5, 51)

The /dev/sda1 is where your Linux has a new block device for your USB drive. You need to mount it now to access its contents. This can be done by the mount command using the following 2 steps.

$ mkdir /mnt/usb
$ mount /dev/sda1 /mnt/usb

Now, you can navigate to the /mnt/usb directory and access the contents in the USB drive. When you want to disconnect your USB drive after usage, do not forget to unmount it using the following command.

$ umount /dev/sda1 /mnt/usb

No comments:

Post a Comment