Friday, 21 June 2013

How to format pendrive in linux command line



                            How to format pendrive in linux command line

#First got to superuser mode and run the mention command.
1. root@linux~# su - root

#That will show all the volume of your hard disk.
2. root@linux~# fdisk -l

Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1   976773167   488386583+  ee  GPT
Partition 1 does not start on physical sector boundary.

Disk /dev/sdc: 4010 MB, 4010803200 bytes
255 heads, 63 sectors/track, 487 cylinders, total 7833600 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0000fc03

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   *        2048     7833599     3915776    c  W95 FAT32 (LBA)

In my system the usb drive is /dev/shc1

# umount /dev/sdc1
3. root@linux~# umount /dev/sdc1

# After you can format this pendrive which file system you want. I am going to format my pendrive with fat32 filesystem.
4. mkfs.vfat /dev/sdc1