Friday, May 4, 2012

Format an external/Second HDD with ext4

First,  delete any existing partition and create a new Linux partition using fdisk:

1
# fdisk /dev/sdb
Assuming /dev/sdb is the external or second 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,  use mkfs.ext4 to format the partition with ext4:

1
# mkfs.ext4 /dev/sdb1
Note that mkfs.ext4 expects a partition as its argument.
use tune2fs to adjust some parameters:

1
2
# tune2fs -m 0 /dev/sdb1
# tune2fs -L secondDisk01 /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/second 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.

No comments:

Post a Comment