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


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

/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


#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



About Divyashree - The GNULINUX Guy

I am a Linux and Opensource enthusiast. I started working on Linux early in 2007 while I was doing my Masters in Computer Science and passed out in 2010. Currently working as a DevOps Developer in in Public/Private cloud domain. my @github : my @nagiosexchange : my @linkedin :☁-a9415615
This entry was posted in TIPS & T RICS. Bookmark the permalink.

6 Responses to Format a PenDrive in Command Line ..

  1. radaGlilkig says:

    Just want to say what a great blog you got here!
    I’ve been around for quite a lot of time, but finally decided to show my appreciation of your work!

    Thumbs up, and keep it going!

    Christian, watch south park online

  2. 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)”

  3. Pingback: usb flashdrive

  4. Stef says:

    How about partitioning the drive first with fdisk:
    fdisk /dev/sdb
    then mount /dev/sdb1

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s