Why can't I mount a ext4 filesystem with blocksize larger than 4 KiB?

Solution Verified - Updated -

Environment

  • Red Hat Enterprise Linux 5
  • Red Hat Enterprise Linux 6
  • Red Hat Enterprise Linux 7
  • Ext4 filesystem

Issue

After creating an ext4 filesystem with a blocksize larger than 4k, the message following error message returns when I try to mount it:

# mount -t ext4 /dev/sda1 /mnt
mount: wrong fs type, bad option, bad superblock on /dev/sda1,
       missing codepage or helper program, or other error

       In some cases useful info is found in syslog - try
       dmesg | tail  or so.
# dmesg | tail 
EXT4-fs (sda1): bad block size 32768

Resolution

Use a blocksize values like 1024, 2048 and 4096 when creating a new ext4 filesystem:

# mkfs.ext4 -b 4096 /dev/sda1
mke2fs 1.41.1 (01-Aug-2012)
Creating filesystem with 2621440 4k blocks and 655360 inodes
Filesystem UUID: 065da23f-201f-4289-95d4-55b5784cd193
Superblock backups stored on blocks: 
    32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done 

Then try to mount it:

# mount -t ext4 /dev/sda1 /mnt/

Finally check if the ext4 filesystem is properly mounted:

# mount |grep ext4
  /dev/sda1 on /mnt type ext4 (rw,defaults)

Root Cause

Although the mkfs.ext4 don't mention anything about supporting block size larger than 4096 bytes (4 KiB), the values supported are 1024, 2048 and 4096 which are multiples of Red Hat Enterprise Linux currently pagesize:

# getconf PAGESIZE
4096

Diagnostic Steps

Diagnostic Steps

Create an ext4 filesystem using a blocksize with value larger than 4k, such as 8k, 16k, 32k or 64k:

# mkfs.ext4 -b 65536 /dev/sda1
Warning: blocksize 65536 not usable on most systems.
mke2fs 1.42.12 (29-Aug-2014)
mkfs.ext4: 65536-byte blocks too big for system (max 4096)
Proceed anyway? (y,n) y
Warning: 65536-byte blocks too big for system (max 4096), forced to continue
Creating filesystem with 163840 64k blocks and 164352 inodes
Filesystem UUID: bb50d8b7-c5ec-4e97-ad63-79e3c03858ef
Superblock backups stored on blocks: 
    65528

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done

Try to mount it:

# mount /dev/sda1 /mnt
mount: wrong fs type, bad option, bad superblock on /dev/sda1,
       missing codepage or helper program, or other error

       In some cases useful info is found in syslog - try
       dmesg | tail or so.

Check dmesg output:

# dmesg 
[46953.477533] EXT4-fs (sda1): bad block size 65536

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.