Formatting an External Hard Disk with Ext4

Recently, I bought an external hard disk formatted with NTFS. Not that there is something really wrong with NTFS but I prefer using ext4.

First, I deleted the existing partition and created a new Linux partition using fdisk:

# fdisk /dev/sdb

Assuming /dev/sdb is the external hard disk. Use d to delete the partition and use n to create a new partition. 83 is the ID of the native Linux partition.

Them, I use mkfs.ext4 to format the partition with ext4:

# mkfs.ext4 /dev/sdb1

Note that mkfs.ext4 expects a partition as its argument.

Finally, I use tune2fs to adjust some parameters:

# tune2fs -m 0 /dev/sdb1 
# tune2fs -L bakap01 /dev/sdb1

The -m option is for adjusting the percentage of reserved blocks. The reserved blocks are used by privileged processes which is by default 5% of the hard disk size. Since I’m using the external hard disk solely as a storage, I set this to 0 so I can also use those 5% for storage. The -L option is for labeling the filesystem.

4 thoughts on “Formatting an External Hard Disk with Ext4”

  1. Thanks for the information. It is a fast and nice reference.

    I add that you can do all job in the first command. In your case:

    # mkfs.ext4 /dev/sdb1 -m 0 -L bakap01

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>