0

OS: Ubuntu 18.04 File system partition size: 472 TB

ext4 file system is successfully created with 4KB block size.

When attempted to create same filesystem with 1KB or 2KB file system block szie getting below error:

mke2fs 1.44.1 (24-Mar-2018)
Warning: specified blocksize 1024 is less than device physical sectorsize 4096
mkfs.ext4: Size of device (0x763cd7f000 blocks) /dev/md127 too big to create a filesystem using a blocksize of 1024.

Is there any way to fix this? I need to run performance experiment with varying the ext4 file system block size.

4
  • 1
    Create small partitions, 2TB for examples, and play with block size. At the end its only for experiment (as you said) Mar 3, 2020 at 12:39
  • @RomeoNinov I actually wanted to run the test to fill the entire file system. that's why I dont want to do it on smaller partition. Mar 4, 2020 at 5:07
  • 1
    specified blocksize 1024 is less than device physical sectorsize 4096 means your physical device exposes a sector size of 4096 and you can't create a block smaller than the unit size
    – phuclv
    Mar 4, 2020 at 6:19
  • are you creating the partition in a VM? You'll never be able to fill the drive unless you have physically enough space
    – phuclv
    Mar 4, 2020 at 15:29

2 Answers 2

3

It work if you use a newer mke2fs:

% mke2fs -t ext4 -b 1024 /tmp/foo.img 472T
mke2fs 1.45.5 (07-Jan-2020)
Creating regular file /tmp/foo.img
Creating filesystem with 506806140928 1k blocks and 3959422976 inodes
Filesystem UUID: 64d8234d-68d8-42a8-9dba-414523184256
Superblock backups stored on blocks: 
    8193, 24577, 40961, 57345, 73729, 204801, 221185, 401409, 663553, 
    1024001, 1990657, 2809857, 5120001, 5971969, 17915905, 19668993, 
    25600001, 53747713, 128000001, 137682945, 161243137, 483729409, 
    640000001, 963780609, 1451188225, 3200000001, 4353564673, 6746464257, 
    13060694017, 16000000001, 39182082049, 47225249793, 80000000001, 
    117546246145, 330576748545, 352638738433, 400000000001

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (262144 blocks): done
Writing superblocks and filesystem accounting information: Done

You can probably make it work by adding -O 64bit to the mke2fs command, but there have been a huge number of bug fixes since the 1.44.x series, so my recommendation is updating to something more up-to-date. In particular, if you want to use online resize, especially with 64-bit file systems, DO NOT use the version of resize2fs with Ubuntu LTS. You really really REALLY want e2fsprogs 1.45.5. See the "bug fixes" section in the release notes.

1
1

IIRC, most filesystems only support a limited number of blocks per file system.

That is, if you pick a block size that is too low, the size of the partition (measured in blocks) gets too big to create the filesystem.

A partition of 472 TiB equals 501856862208 blocks if you use 1K-Blocks and my guess is that this exceeds the limit. If, however, you use blocks of 4096 B, then your file system would only be 125464215552 blocks in size which apparantly still works.

If you really need a file system with 1K blocks, you will have to divide your disk into several smaller partitions.

Alternatively, if you don't mind wasting disk space, you could create a file system that uses only part of the partition. I. e. there would be a filesystem at the beginning of the partition and the rest of the partition would be unused.

2
  • 1
    it's far from reaching the limit. The maximum size for an ext4 partition is 1 EiB, which is more than 2000 times larger than 472 TB. ext4 uses 48-bit addressing which means you can have 281474976710656 blocks
    – phuclv
    Mar 4, 2020 at 15:26
  • Ok, then my guess has to be wrong.
    – erebus
    Mar 4, 2020 at 20:20

Your Answer

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

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