File Too Large
Production Risk
Common in logging and backup pipelines — log rotation or size monitoring should prevent unbounded growth.
EFBIG (errno 27) is returned when a write would cause a file to exceed the maximum file size allowed by the filesystem, the OS, or the process's resource limit (RLIMIT_FSIZE).
- 1Writing to a file on a FAT32 filesystem that would exceed the 4 GB file size limit
- 2The process has a per-process file size limit (ulimit -f) set too low
- 3An append-only log file has grown beyond the filesystem's maximum file size
Writing to a FAT32-formatted drive beyond 4 GB.
# Writing a file larger than FAT32 limit: dd if=/dev/zero of=/mnt/fat32drive/bigfile bs=1M count=4097 # dd: error writing '/mnt/fat32drive/bigfile': File too large
expected output
write: File too large (EFBIG)
Fix 1
Use a filesystem that supports large files
WHEN When working with files larger than 4 GB
# Format with ext4 or XFS instead of FAT32: mkfs.ext4 /dev/sdX1 # ext4 supports files up to 16 TB
Why this works
FAT32 has a hard 4 GB per-file limit. ext4, XFS, and NTFS all support much larger files.
Fix 2
Increase or remove the process file size limit
WHEN When ulimit -f is set too low
# Check current limit: ulimit -f # Remove limit: ulimit -f unlimited
Why this works
RLIMIT_FSIZE is a per-process limit on file size. Raising it allows the process to write larger files.
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev