mkfs.ext4 is taking hours to complete on 4 TB RAID 5

mkfs.ext4 -O uninit_bg=1 -E lazy_itable_init=1

will force the time consuming parts of the initialization into the background.

lazy_itable_init[= <0 to disable, 1 to enable>]

If enabled and the uninit_bg feature is enabled, the inode table will not be fully initialized by mke2fs. This speeds up filesystem initialization noticeably, but it requires the kernel to finish initializing the filesystem in the background when the filesystem is first mounted. If the option value is omitted, it defaults to 1 to enable lazy inode table initialization.

uninit_bg

Create a filesystem without initializing all of the block groups. This feature also enables checksums and highest-inode-used statistics in each blockgroup. This feature can speed up filesystem creation time noticeably (if lazy_itable_init is enabled), and can also reduce e2fsck time dramatically. It is only supported by the ext4 filesystem in recent Linux kernels.