Format a PenDrive in Command Line ..

Insert the pendrive in the USB port ,

In command mode su to root mode ,

Check wheather pendrive is mounted or not

#mount

From the output of mount get the location where the pendrive is mounted and the block device name .
e.g.

/de/sdb on /media/USB-STICK type vfat (rw)

USB-STICK -The name of the pendrive
/media/ – Location , where pendrive is mounted
/dev/sdb – The block device name of the pendrive
Now before formatting the pendrive has to be unmounted .

#umount /dev/sdb

or

#umount /media/USB-STICK

confirm it by giving the mount command again ,wheather mounted or not ,
if not continue ,

Now make the filesystem as u need (fat,ext3 etc)

To format with ext3 filesystem

#mkfs.ext3 /dev/sdb

To format with fat file system

#mkfs.vfat /dev/sdb

Now mount the pen drive by plugout and plugin or mount by mount command

mount /dev/sdb /LOCATION WHERE TO MOUNT

6 thoughts on “Format a PenDrive in Command Line ..

  1. Xeleema says:

    Good post!
    However, I think you have a typo;
    “/de/sdb on /media/USB-STICK type vfat (rw)”
    should be
    “/dev/sdb on /media/USB-STICK type vfat (rw)”
    right?

  2. Pingback: usb flashdrive

Leave a Reply