How to format USB drive in Linux?

Have you ever fell in need of formatting a USB drive in Linux? Yes, its easy in Microsoft Windows®, and much more easier in Linux via the command line.

To format a USB storage device with FAT32 file system, use the below command.

mkfs –t vfat <USB-device-mount-point>

To find out the USB device mount point, utilize the ‘fdisk’ command.

fdisk -l

The output would be something similar to the one below:

[bash ~]# fdisk -l

Disk /dev/sda: 980.0 GB, 980759350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        5496    44146588+  83  Linux

Disk /dev/sdb: 8032 MB, 8032092160 bytes
131 heads, 50 sectors/track, 2395 cylinders
Units = cylinders of 6550 * 512 = 3353600 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               2        2396     7839744    b  W95 FAT32

On my system, the last line in the above listing – ‘/dev/sdb1’ is the USB mount point.


How to format the USB storage device with file systems other than FAT32?

To format a USB with:

  • Extended2 File System:

mkfs.ext2 <USB-device-mount-point>

  • Extended3 File System:

mkfs.ext3 <USB-device-mount-point>

  • Extended4 file system (if you have the latest version of any Linux OS, ext4 should be supported):

mkfs.ext4 <USB-device-mount-point>

  • Journal File System:

mkfs.jfs <USB-device-mount-point>

  • NTFS File System:

mkfs.ntfs <USB-device-mount-point>

  • XFS

mkfs.xfs <USB-device-mount-point>

  • ReiserFS

mkfs.reiserfs <USB-device-mount-point>


Resources:

Advertisements

2 thoughts on “How to format USB drive in Linux?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s