Filesystem - Parted & mkfs


Format Filesystem in Linux using Parted & mkfs

Install Parted

Install parted if its not installed already. For Ubuntu /Debian systems

sudo apt-get install parted

Check plugged in sd card and unmount if required

sudo su -
blkid

From output of blkid we can get the sd card/disk info, Sample

/dev/sda1: UUID="d93d4db2-6c14-4725-90d9-2bc12adc0bb4" TYPE="ext4" PARTUUID="71c29940-01"

To unmount,

sudo umount /dev/sda1

Format entire disk to ext4 single partition

Assuming sd card/disk is device /dev/sda, select device in parted and follow the steps For mklabel step select partition as primary file system type as ext4 Start as 1 End as 100% to use all disk as 1 partition

parted
select /dev/sda
print
mklabel msdos
quit

Now use mkfs to create the partition

mkfs.ext4 /dev/sda1