How to Format Pen Drive / USB Drive Using Linux Terminal

How to Format Pen Drive / USB Drive Using Linux Terminal / Ubuntu Console / Linux Mint / RHEL / CentOS Command line with simplified step by step methods. Pen Drive / USB Drive is the most important storage drive that have portable in nature. When we carry data from one place to another we preferred portable hardware devices such as pen drive or USB drive are the most recommended sources to carry the data. Every one is most familiar with the formating of pen drive / USB drive with GUI formating methods but when the Points came to pen drive the first recommend opinion is GUI and second is CUI both are flexible in nature.

How to format Pen Drive / USB Drive Using Linux Terminal

Step-I (Starting of Linux Terminal)

Start the Linux terminal using the Ctrl + Alt + T

Step-II (Login as Root User)
$ su -

After entering the Password hit ENTER button

Step-III (Checking the Pen Drive / USB Drive mount point)
# fdisk -l
Sample Output
WARNING: GPT (GUID Partition Table) detected on '/dev/sdb'! The util fdisk doesn't support GPT. Use GNU Parted.

Disk /dev/sdb: 250.1 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders, total 488397168 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: 0x6b07969f

Device Boot Start End Blocks Id System
/dev/sdb1 * 2048 206847 102400 7 HPFS/NTFS/exFAT
/dev/sdb2 206848 143566847 71680000 7 HPFS/NTFS/exFAT
/dev/sdb3 143566910 426172319 141302705 f W95 Ext'd (LBA)
/dev/sdb4 426172320 488392064 31109872+ 83 Linux
/dev/sdb5 143566912 365514751 110973920 7 HPFS/NTFS/exFAT
/dev/sdb6 365527008 426172319 30322656 7 HPFS/NTFS/exFAT

Disk /dev/sdd: 8036 MB, 8036285952 bytes
213 heads, 4 sectors/track, 18422 cylinders, total 15695871 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: 0x00092582

Device Boot Start End Blocks Id System
/dev/sdd1 * 2048 15692799 7845376 c W95 FAT32 (LBA)

Note: Pen Drive /  USB Drive Partition detected as according to the connected drives:

This path can be changed according to the Linux Distribution Used

/dev/sdd1 , /dev/sdc1, ……………

/dev/sdd2 , /dev/sdc2, …………..

/dev/sdd3 , /dev/sdc3, ……………

….and So on in numeric format

Step-IV (Unmount the Pen Drive / USB Drive Partitions)
# umount /dev/sdd1
Step-V (Start Formating Pen drive / USB Drive using Linux Terminal)
Syntax of command

# mkfs.FORMATEXTENSION -n ‘NAMEOFDEVICE’ -I DRIVELOCATION

where

mkfs : Make Linux file systems using format with different Linux extensions

-n : name of devices

-l : Fixed partition for Pen Drive / USB Drive

Format the Pen Drive / USB Drive using Partition Scheme

FAT partition Scheme

# mkfs.vfat -n 'NAMEOFDEVICES' -I /dev/sdd1

NTFS partition Scheme

# mkfs.ntfs -n 'NAMEOFDEVICES' -I /dev/sdd1

EXT2 partition Scheme

# mkfs.ext2 -n 'NAMEOFDEVICES' -I /dev/sdd1

EXT3 partition Scheme

# mkfs.ext3 -n 'NAMEOFDEVICES' -I /dev/sdd1

EXT4 partition Scheme

# mkfs.ext4 -n 'NAMEOFDEVICES' -I /dev/sdd1

MSDOS partition Scheme

# mkfs.msdos -n 'NAMEOFDEVICES' -I /dev/sdd1

VFAT partition Scheme

# mkfs.vfat -n 'NAMEOFDEVICES' -I /dev/sdd1

XFS partition Scheme

# mkfs.xfs -n 'NAMEOFDEVICES' -I /dev/sdd1

BFS partition Scheme

# mkfs.bfs -n 'NAMEOFDEVICES' -I /dev/sdd1
Step-VI (Check the formated Pen Drive / USB Drive Size)
Mount the Pendrive / USB Drive
# mount /dev/sdd1
Check the size
# df

Sample Output

Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sdb4 30490292 4877612 24040804 17% /
none 4 0 4 0% /sys/fs/cgroup
udev 1988604 4 1988600 1% /dev
tmpfs 400820 1404 399416 1% /run
none 5120 4 5116 1% /run/lock
none 2004088 708 2003380 1% /run/shm
none 102400 16 102384 1% /run/user
/dev/sdb6 30322652 23600308 6722344 78% /media/gopal/080D1A14080D1A14
/dev/sdb5 110973916 91054504 19919412 83% /media/gopal/AAC26D01C26CD35D
/dev/sdb2 71679996 43961808 27718188 62% /media/gopal/70FC214AFC210BC2

Final Words

Finally you have formated using the Linux Terminal using various partition extensions formats. This trick is the most working and perfect formatting technique using the Linux Terminal to format the Pen Drive / USB Drive. For more support and information on this use comment section below.

Related Post

Develop New SysAdmin Skills with E-books (FREE Download)

COMMENTS