4

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 2

9

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
0

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
  • well, I eventually found out I need to re-compile the kernel in order to use 16k blocks.
    – JustAGuy
    Feb 19, 2018 at 19:09
  • @JustAGuy, Is it a feasible option for you to re-compile the kernel?
    – sudodus
    Feb 19, 2018 at 19:26
  • Unfortunately not.
    – JustAGuy
    Feb 20, 2018 at 8:21
  • @JustAGuy, Would a FAT file system work for your application, and in that case, would sector size = 16384 serve the purpose you wanted to implement with ext4? According to man mkfs.vfat you can try the option -S 16384; at least you can test the performance of such a file system for a huge partition.
    – sudodus
    Feb 20, 2018 at 19:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .