To create an ext4 file system, use the mkfs. ext4 command.
In general, the default options are optimal for most usage scenarios:
# mkfs. ext4 /d ev/device
Below is a sample output of this command, which displays the resulting file system geometry and features:
mkfs. ext4 command output
# mkfs.ext4 /dev/sdb1
mke2fs 1.41.12 (17-May-2010)
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
245280 inodes, 979456 blocks
48972 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=1006632960
30 block groups
32768 blocks per group, 32768 fragments per group
8176 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736
Writing inode tables: done
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done
For striped block devices (for example, RAID 5 arrays), the stripe geometry can be specified at the time of file system creation. Using proper stripe geometry greatly enhances the performance of an ext4 file system.
When creating file systems on LVM or MD volumes, mkfs. ext4 chooses an optimal geometry. This may also be true on some hardware RAID s which export geometry information to the operating system.
To specify stripe geometry, use the -E option of mkfs. ext4 (that is, extended file system options) with the following sub-options:
Specifies the RAID chunk size.
stripe- width = value
Specifies the number of data disks in a RAID device, or the number of stripe units in the stripe.
For both sub-options, value must be specified in file system block units. For example, to create a file system with a 64k stride (that is, 16 x 4096) on a 4k-block file system, use the following command:
# mkfs. ext4 -E stride= 16 ,stripe-width= 64 /dev/device
For more information about creating file systems, refer to man mkfs. ext4 .
It is possible to use tune2fs to enable some ext4 features on ext3 file systems, and to use the ext4 driver to mount an ext3 file system. These actions, however, are not supported in Red Hat Enterprise Linux 7, as they have not been fully tested. Because of this, Red Hat cannot guarantee consistent performance and predictable behavior for ext3 file systems converted or mounted in this way.
However, It is also possible to add a specific UUID to the file system.