Sunday, July 19, 2009

How To Format a USB Pen Drive in Linux

http://www.cyberciti.biz/faq/howto-format-usb-pen-drive/

Q. How do I format a USB pen drive under Ubuntu Linux for ext3 file system?
A. You can format USB pen drive with the help of following commands:

[a] fdisk : Partition table manipulator for Linux

[b] mkfs.ext3 : Create an ext2/ext3 filesystem by formatting given partition name (/dev/partition)

[c] e2label : Change the label on an ext2/ext3 filesystem

First make sure USB pen is not mounted. Click on Places > Computer > Select USB pen > Right click > Select Unmount Volume.

Let us assume that /dev/sda1 is your partition name for USB pen. To format type the following command (Open X terminal and type the command)
$ sudo mkfs.ext3 /dev/sda1
Caution: Careful while entering device/partition name; wrong name can wipe out entire hard disk!!!
Now use e2label command to change the filesystem label on the ext3 filesystem located on device /dev/sda1:
$ sudo e2label /dev/sda1 usb-pen
You can also create an MS-DOS/Windows XP file system under Linux, enter:
$ sudo mkfs.vfat /dev/sda1

Now you are ready to use USB pen.