A batch job writes millions of tiny files per day. Which filesystem and options would you pick?
AdvancedScenarioStorage, disks and filesystems
Answer
Situation read → Inode density and metadata performance matter more than throughput.
What I'd do →
- Prefer XFS: inodes are allocated dynamically, so you don't run out early.
- If ext4 is required, format with more inodes:
mkfs.ext4 -i 4096 /dev/sdbor-N <count>. - Mount with
noatimeto avoid a metadata write on every read. - Use a directory hashing scheme (
ab/cd/abcdef...) so no single directory holds millions of entries. - Reconsider the design: object storage or packing files into archives is often better.
Why → ext4 fixes the inode count at format time; tiny files exhaust inodes before blocks.
Interview tip → Show you'd monitor df -i alongside df -h.
More on Storage, disks and filesystems
You get paged at 3 AM: the root filesystem on a production server is at 98% and climbing. Walk through your response.BeginnerA new 200 GB EBS volume is attached to an EC2 instance. How do you make it usable and persistent across reboots?BeginnerThe `/var` LVM logical volume is nearly full and there is free space in the volume group. How do you grow it online?BeginnerThe volume group has no free space. You've been given a new disk. How do you add it to grow `/var`?IntermediateA cloud VM's root disk was enlarged from 30 GB to 80 GB in the console, but `df` still shows 30 GB. What do you do?BeginnerYou need to move a busy MySQL data directory from the root disk to a new, faster volume. Plan it.Intermediate