What happens if the limit of 4 billion files was exceeded in an ext4 partition?

Presumably, you'll be seeing some flavor of "No space left on device" error:

# truncate -s 100M foobar.img
# mkfs.ext4 foobar.img
Creating filesystem with 102400 1k blocks and 25688 inodes
---> number of inodes determined at mkfs time ^^^^^
# mount -o loop foobar.img loop/
# touch loop/{1..25688}
touch: cannot touch 'loop/25678': No space left on device
touch: cannot touch 'loop/25679': No space left on device
touch: cannot touch 'loop/25680': No space left on device

And in practice you hit this limit a lot sooner than "4 billion files". Check your filesystems with both df -h and df -i to find out how much space there is left.

# df -h loop/
Filesystem      Size  Used Avail Use% Mounted on
/dev/loop0       93M  2.1M   84M   3% /dev/shm/loop
# df -i loop/
Filesystem     Inodes IUsed IFree IUse% Mounted on
/dev/loop0      25688 25688     0  100% /dev/shm/loop

In this example, if your files are not 4K size on the average, you run out of inode-space much sooner than storage-space. It's possible to specify another ratio (mke2fs -N number-of-inodes or -i bytes-per-inode or -T usage-type as defined in /etc/mke2fs.conf).


Once the limit is reached, subsequent attempts to create files will fail with ENOSPC, indicating that the target file system has no room for new files.

In the scenario you describe, this will typically result in the transfer aborting once the limit is reached.

Tags:

Linux

Ext4