Analyze. Act. Achieve.
Kurinchilion KURINCHILION Analyze. Act. Achieve.

News

Mount, Read, Write, Access USB Flash Drive in Ubuntu

How to access USB Flash Drive?

To know the drives and their partition you need to execute # fdisk -l

Another option is to list the last 5 entries from /dev to know what devices got attached $ ls -ltr /dev | tail

And another option is to use the lsusb command.

USB Flash drive will normally be listed down as /dev/sdb1

Create a directory under /media to load or mount USB Flash drive content $ sudo mkdir /media/flash_drive

Mount the drive content $ sudo mount -t vfat /dev/sdb1 /media/flash_drive -o uid=1000,gid=100,utf8,dmask=027,fmask=137

Once you have finished read or write access to the drive, ensure that you come out of the drive before you unmount from it $ cd / $ sudo umount /media/flash_drive or, $ sudo umount /dev/sdb1

To format the USB Flash drive, you need to mount the drive first and then use the following commands

$ sudo mkfs.ext3 /dev/sdb1

Ensure that you use the correct device for formatting. If you enter the wrong device name, then you can be in a big trouble.

To create a label for the drive $ sudo e2label /dev/flash_drive MyFlashDrive

To create windows based file system, $ suod mkfs.vfat /dev/sdb1

Reference: https://help.ubuntu.com/community/Mount/USB