Here’s how to format a Flash Drive using the Command Line in Linux Terminal.
I. Identify the location of The Flash Drive installed in the linux system
lsblk
The result is:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 111,8G 0 disk
├─sda1 8:1 0 549M 0 part
├─sda2 8:2 0 56,3G 0 part
└─sda3 8:3 0 55G 0 part /
sdd 8:16 1 3,7G 0 disk
└─sdd1 8:17 1 3,7G 0 part /media/helmiz/HELMI <<< My Flash Drive
sr0 11:0 1 1024M 0 rom
II. Unmount The Flash Drive
sudo umount /dev/sdd1
III. Create partition and wipe all The Flash Drive data
Type FDISK:
sudo fdisk /dev/sdd
Type
p
for print information about our flash drive in the screen:Disk /dev/sdd: 3,75 GiB, 4002910208 bytes, 7818184 sectors Disk model: DataTraveler G2 Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x15f006ae Device Boot Start End Sectors Size Id Type /dev/sdd1 2048 7818183 7816136 3,7G 7 HPFS/NTFS/exFAT
Type
d
for wipe partitions.Type
o
for create new DOS partition.Type
n
for create new partition.The next thing will show type of partitions Primary or Extended, press enter.
Partition type p primary (0 primary, 0 extended, 4 free) e extended (container for logical partitions) Select (default p):
And then we will create number of sector partitions, just press enter for default value:
Using default response p. Partition number (1-4, default 1): First sector (2048-7818183, default 2048): Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-7818183, default 7818183):
Default type of partition will created as Linux. Type
l
show all type of partitions.7 HPFS/NTFS/exFAT
for NTFS partition andb W95 FAT32
for Fat32 partition. Typet
for change the partition type.Type
w
for write the flash driveType
q
for quit.
IV. Format Flashdisk
Format with Fat32:
sudo mkfs.vfat -F32 -n NAME /dev/sdd1
Format with NTFS:
sudo mkfs.ntfs -f -L NAMA /dev/sdd1
Notes: -
-n NAME
: Flash Drive name (capital letters)Format with exFat:
sudo apt install dosfstools exfat-fuse exfat-utils sudo mkfs.exfat -n NAMA /dev/sdd1
V. Flash Drive not detected by Windows
- Go To Partition Manager in Windows.
- Choose and right click in Flash drive which not detected.
- Click Change letter….
- Choose the Letter for our Flash Drive.
VI. Bibliography
Kumar, Rahul. How To Format USB Drive in Linux Command Line (accessed on 1 April 2020).
Saive, Ravi. 2015. 10 fdisk Commands to Manage Linux Disk Partitions (accessed on 26 Mei 2020).
Bunic, Darko. 2020. How to create FAT32 USB drive on Linux (accessed on 26 Mei 2020).
Gary Explains. 2019. How to Partition and Format a Disk in Linux (accessed on 26 Mei 2020).