Formatting an ext4 partition with a 16KB block, possible?
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) nIs it suppose to be safe?
12 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.
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/sdxnwhere 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.
4More in general
"Zoraya ter Beek, age 29, just died by assisted suicide in the Netherlands. She was physically healthy, but psychologically depressed. It's an abomination that an entire society would actively facilitate, even encourage, someone ending their own life because they had no hope. Th…"