Wednesday, January 30, 2008

Format Pen Drive or create partition in pen drive on Linux

To format a pen drive or Create a new partition in pen drive using the command line in Linux platform, please follow the following steps.

  • Type sudo su for the super user access
  • Type fdisk -l to list available drives/partitions.Note which device is your flash drive (Example: /dev/sda).Here i have place the x as a drive later, so replace it as per your drive latter. For example: if your pen drive is sdb then replace x with b.
  • Type umount /dev/sdx1
  • Type fdisk /dev/sdx . This will ask you commands you want tobe perform. so please follow the following steps
    • type p to show the existing partition.
    • type d to delete the existing partition.
    • type p again to show any remaining partitions (if partitions exist, repeat previous steps)
    • type n to make a new partition. It will ask for partition type
      • e for extended partition
      • p for primary partition
    • type p for primary partition
    • type 1 to make first partition (partition no. starts from 1 to 4)
    • type starting cylinder for a partition or just Hit the Enter to use default 1st cylinder
    • type ending cylinder to set the partition size or just hit Enter for the default last cylinder (so you have only one partition)
    • type a to make this partition active, it will ask for partition number to active
    • type 1 to select partition 1
    • type t to select the change the partition File System. it will ask you for file system
    • type 6 to select FAT16 file system
    • type w to write a new partition table
  • Type umount /dev/sdx1 to ensure the 1st partition is unmounted
  • Type mkfs.vfat -F 16 -n ubuntu710 /dev/sdx1 to format the first partition
  • Remove and Re-insert your flash drive

5 comments:

Aman K said...

Hi Dhaval
I must say your blog is quite a helpful one. Hope to find many other interesting issue cleared thru your blog.

Well for now, extending this post, i would like to know if the procedure to partitioning my JetFlash Stick, and providing some sort of security to one of the partition (password protection may be).

Thanks in Advance.
-Aman K

priyesh said...

this blog is very useful for formatiing pendrive and i got success in it.

priyesh said...

Very good Dhaval sir KJeep it up

priyesh said...

Very good Dhaval bhai
your blog is vwery helpful.

priyesh said...

everytime i want 2 format my pendrive i visit ur blog....rock on dhaval bhai ;)