Formatting Ext4 volumes beyond the 16TB limit

Article98
CreatedFebruary 22, 2013
Authorcaurelio
Ratingn/a

All filesystems have limits, and the Ext family is no exception. Using your standard 4KiB block size, the 32-bit Ext3 has a well-known limit of 16TB for a volume. With the advance of storage mediums and greater availability of increased capacity, Ext4 was developed to overcome this limitation. Ext4 will now support volumes up to 1 exbibyte (EB).

This is a fantastic, improvement, but what happens when you actually go to format one of these volumes? If your system is running with some of the older fs tools (like Debian Squeeze), then you will probably encounter this scenario when trying to format a large volume (let's say we have a 19TB partition at /dev/vg0/lv_data for this example).

# mkfs -t ext4 /dev/vg0/lv_data
mke2fs 1.42.7 (21-Jan-2013)
mkfs.ext4: Size of device (0x131a47800 blocks) /dev/vg0/lv_data too big to be expressed in 32 bits using a blocksize of 4096.

 
Although the Ext4 filesystem has been updated to support 64-bit volumes, the tools may not be. The solution here is to grab the latest version of the e2fsprogs utilities and build them yourself.
 
First, grab the utilities from sourceforge:
# cd /opt/
# wget -Oe2fsprogs-1.42.7.tar.gz \
http://downloads.sourceforge.net/project/e2fsprogs/e2fsprogs/v1.42.7/e2fsprogs-1.42.7.tar.gz?r=http%3A%2F%2Fe2fsprogs.sourceforge.net%2F&ts=1361548232&use_mirror=superb-dca3
 
Then, extract the files and setup for your build
# tar -xzvf e2fsprogs-1.42.7.tar.gz
# cd e2fsprogs-1.42.7
# mkdir build
# cd build
 
If you don't have dev tools (like a compiler and make), install them now
# apt-get install build-essential
 
Now you are ready to build the tools:
# ../configure
# make
# make install
 
Before actually creating your filesystem, however, you are going to wan to edit your /etc/mke2fs.conf file and enable the 64-bit feature flag automatically for a big disk. It should look something like this:
[fs_types]
    ext4 = {
        features = has_journal,extent,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize
        auto_64-bit_support = 1 # <—- add this line
        inode_size = 256
    }
 
Finally, you are ready to create your volume! If you are having trouble with the standard tools, you can run this to manually specify your options:
# mke2fs -O 64bit,has_journal,extents,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize -i 4194304 /dev/vg0/lv_data
 
Now, you should be able to mount your volume and use it!
# mount /dev/vg0/lv_data /mnt
# cd /mnt
 
Viola! Using the most up-tp-date utilities, creating and using Ext4 filesystems in Linux that are over 16TB should be a breeze.
comments powered by Disqus
Copyright © 2010-2012 : Admin