Formatting a partition from command line

When you need to format a partition from the command line, a few commands are all you need. Here’s the typical workflow.

First, create the filesystem:

mkfs.ext4 /dev/sdxy

If you want to reserve less space for the root user:

tune2fs -m 0 /dev/sdxy

Check the filesystem for errors before mounting:

fsck.ext4 -fy /dev/sdxy

Then mount it where you need it:

mount /dev/sdxy /wherever/I/want

Replace /dev/sdxy with your actual partition and /wherever/I/want with your mount point.

Enjoy!

Leave a Reply

Your email address will not be published. Required fields are marked *