Thursday, August 20, 2009

Format USB drive / Pen Drive on LINUX - Ubuntu

Step 1:
insert the pendrive in the USB port and wait for it to be detected (or mounted according to Linux)

once it is mounted (ie it opens in a window) , go to the terminal and type the following command :

$ df -h

it will display the list of all mounted drives on your system. It will look something like image shown below :


now very carefully note the path for your pendrive , it would be written in front of the name of your pendrive. Like in above example the data to be noted is /dev/sdb

it might be in your case something else like /dev/sd1
Note: be very sure that you get the correct name otherwise you will end up formatting some other drive

Step 2:

Unmount the USB or Pendrive.
It can be done in two ways :

1. simply right click on pendrive icon on desktop and unmount.
or by
2.form terminal run following command :

$ sudo umount /dev/sdb

i prefer the second method since if pendrive is unmounted after command you can be sure you got the correct drive name in step 1.

Remember : you r only supposed to unmount the pendrive not to remove form the usb port.

Step 3 :

run the following command from the terminal :

$ sudo mkfs.vfat -I /dev/sdb

which will format the pendrive. If you want to provide and label or name to ur pendrive use following :

$ sudo mkfs.vfat -n "name/label" -I /dev/sdb

replace
"name/label" with the name u want to give to usb drive
Now ur pendrive is formatted.

Note: u can format in any file system u wish to by replacing vfat by that name example ext3 .

1 comment:

About Me

My photo
Hi Friends, I am Samarth currently pursuing my Masters degree in Information Technology from International Institute of Information Technology ,Bangalore .