Skip to content
Commit af17808d authored by Mike Fleetwood's avatar Mike Fleetwood Committed by Curtis Gedak
Browse files

Limit maximum ext2/3/4 volume size to just less than 16 TiB (#766910)

Maximum size of an ext2/3/4 volume is 2^32 - 1 blocks [1], ignoring ext4
with 64bit feature.  That is just under 16 TiB with a 4K block size.

    # truncate -s 16T /mnt/1/sparse.img
    # ls -l /mnt/1/sparse.img
    -rw-r--r--. 1 root root 17592186044416 May 28 19:33 /mnt/1/sparse.img
    # losetup /dev/loop0 /mnt/1/sparse.img
    # mkfs.ext3 /dev/loop0
    mke2fs 1.43 (17-May-2016)
    mkfs.ext3: Size of device (0x100000000 blocks) /dev/loop0 too big to be expressed
            in 32 bits using a blocksize of 4096.
    # losetup -d /dev/loop0
    #
    #
    # truncate -s $((16*1024**3-4))K sparse.img
    # ls -l /mnt/1/sparse.img
    -rw-r--r--. 1 root root 17592186040320 May 28 19:51 /mnt/1/sparse.img
    # losetup /dev/loop0 /mnt/1/sparse.img
    # mkfs.ext3 /dev/loop0
    mke2fs 1.43 (17-May-2016)
    Discarding device blocks: done
    Creating filesystem with 4294967295 4k blocks and 536870912 inodes
    Filesystem UUID: 9721d8d9-8711-499b-aae4-8ea4d9e16ca2
    Superblock backups stored on blocks:
            32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
            4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
            102400000, 214990848, 512000000, 550731776, 644972544, 1934917632,
            2560000000, 3855122432

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

    # losetup -d /dev/loop0
    # rm /mnt/1/sparse.img

Actually limit the maximum volume size to 1 MiB less than 16 TiB for
coding reasons explained in the FIXME comment.

[1] Ext4 Disk Layout, Blocks
    https://ext4.wiki.kernel.org/index.php/Ext4_Disk_Layout#Blocks

Bug 766910 - Multiple boot loaders don't work on 64bit EXT4 file systems
parent 58d40978
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment