M BUZZ CRAZE NEWS
// general

Formatting an ext4 partition with a 16KB block, possible?

By Gabriel Cooper

I've been looking all over for this. I need to format a 6TB drive I have with a 16KB AUS in order to achieve maximum dedup. Is this possible?

I tried this with mkfs and got the following warning:

mkfs.ext4: 16384-byte blocks too big for system (max 4096)
Proceed anyway? (y,n) n

Is it suppose to be safe?

1

2 Answers

You need to use mkfs.ext4 with -C 16384 and also -O bigalloc. From man mkfs.ext4:

-C cluster-size Specify the size of cluster in bytes for filesystems using the bigalloc feature. Valid cluster-size values are from 2048 to 256M bytes per cluster. This can only be specified if the bigalloc feature is enabled. (See the ext4 (5) man page for more details about bigalloc.) The default cluster size if bigalloc is enabled is 16 times the block size.

The default cluster size would be 64KiB (16x4) if using 4096 byte blocks, as found in /etc/mke2fs.conf. This only applies if bigalloc is enabled at all; otherwise the cluster size is the block size.

Depending on the number of files you expect, you may also wish to set -i inode_ratio. The default is 16KiB+ on most systems, so you won't run out; but it may be inefficient if the average file is much larger.

The version of ext4 in your system's kernel must support the bigalloc feature, added in Linux 3.2.

2

According to man mkfs.ext4,

OPTIONS -b block-size Specify the size of blocks in bytes. Valid block-size values are 1024, 2048 and 4096 bytes per block. If omitted, block-size is heuristically determined by the filesystem size and the expected usage of the filesystem (see the -T option). If block- size is preceded by a negative sign ('-'), then mke2fs will use heuristics to determine the appropriate block size, with the constraint that the block size will be at least block-size bytes. This is useful for certain hardware devices which require that the blocksize be a multiple of 2k.

It seems to me that only block-size values 1024, 2048 and 4096 bytes are valid, but maybe these values are only examples. You can try with the option

sudo mkfs.ext4 -b 16384 /dev/sdxn

where x is the drive letter and n is the partition number. I tested in 16.04 with the xenial kernel (linux 4.4 series), and mkfs.ext4 complained

mkfs.ext4: 16384-byte blocks too big for system (max 4096)
Proceed anyway? (y,n) 

I continued to create the file system, but could not mount it because of errors, so the answer is No, it does not work, unless you mount it with some special method.

4

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy