NAS - Build a Linux NAS - Create a Filesystem

sudo mkfs.ext4 /dev/md0

NOTE: /dev/md0 can be used now just as any other block device.

The following formulae can be used to calculate the best settings for the filesystem:

  • blocksize (in KiB) = 4
  • chunksize (in KiB) = 512
  • stride = chunksize / blocksize = 512 / 4 = 128;
    • IMPORTANT: stride has to be multiple of 2!
  • effective_disks =
    • If Raid6 = number of disks - 2.
    • if Raid5 = number of disks - 1.
    • if Raid1 = number of disks / 2.
    • if Raid10 = number of disks / 2.
  • stripe-width = stride * effective_disks;
mkfs.ext4 -b 4096 -E stride=128,stripe-width=256 /dev/md0

For further details, get a recent e2fsprogs and look for stride, stripe etc. in the man page.