Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like to make a partition for keeping ISO images of nightly builds. Most of files will be bigger than 1Mb. Unfortunately ext2/ext3/ext4 supports only 4Kb blocks.

# mkfs.ext4 -b 1048576 -L DISTR -m 0 /dev/sdb1 
mkfs.ext4: invalid block size - 1048576

Is there any other reliable filesystem that can be used in order to reduce fragmentation?

share|improve this question
ext4 tries to avoid fragmentation, for example it allocates extends (block groups) up to 128 MiB. Because of this, you should not get much fragmentation problems if you keep the disk usage under a certain limit. Depending how the ISO images are generated, it could be helpful to reserve space for them by using fallocate. – jofel Jan 15 '13 at 18:08
Unfortunately that's not unders my control... – Anthony Ananich Jan 15 '13 at 18:25
If you are trying to prevent fragmentation, -m 0 is certainly not what you want. As jofel said, that reserved space is used to reduce fragmentation. Also, if you had a 1MB block size and stored a 1.00001MB file, it would consume 2MB of disk space. – jordanm Jan 15 '13 at 18:48
Most of files are from 40Mb to 4.7Gb – Anthony Ananich Jan 15 '13 at 21:43
up vote 1 down vote accepted

man mke2fs states

Valid block-size values are 1024, 2048 and 4096 bytes per block

If we have a look to fs/block_dev.c we could find following:

int set_blocksize(struct block_device *bdev, int size)
        /* Size must be a power of two, and between 512 and PAGE_SIZE */
        if (size > PAGE_SIZE || size < 512 || !is_power_of_2(size))
                return -EINVAL;

And finally we can determine PAGE_SIZE:

# getconf -a| grep PAGE_SIZE
PAGE_SIZE                          4096
share|improve this answer
That's convincing – Anthony Ananich Jan 15 '13 at 21:42

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.