Skip to content

How do I create and tune an ext4 partition from the command-line? bez tuner

First and foremost: !! WARNING !!

These commands are EXAMPLES. DELETING partitions, MODIFYING and FORMATTING filesystems destroys data and/or may prevent your machine from booting. Make backups. Use at own risk. Try on a machine you don't mind losing all data on. caveat admin.

To quickly set up a drive up as a single ext4 partition...

View detected devices of class "DISK"

lshw -C disk

View existing partition table(s)

fdisk -l

Edit the partition table for my chosen device (in this case, "sdx")

fdisk /dev/sdx

Within FDISK, press:

    d ...to delete the current partition

    n ...to create a new partition

    p ...to specify it as a PRIMARY partition

    1 ...to set it as the 1ST primary partition

    w ...to write the changes.

Display the new partition table:

fdisk -l

Format the new partition's filesystem as type ext4

mkfs -t ext4 /dev/sdx1

Create a new directory where the new drive will mount into:

mkdir /storage
mount /dev/sdx1 /storage

https://askubuntu.com/questions/384062/how-do-i-create-and-tune-an-ext4-partition-from-the-command-line

Edited by peturbg