Thin Pool at 96% With Snapshots and a Deadline
A CentOS Stream 9 database host uses LVM thin provisioning. Volume group vg_data has a 2 TB thin pool named thinpool; 1.8 TB is allocated across 12 thin volumes. The application volume lv_app is 1.2 TB and its filesystem reports 45% used. A five-day-old snapshot snap_app_daily consumes about 400 GB in the pool. lvs shows data_percent 96 and metadata_percent 18. The VG has 250 GB unallocated; the SAN has no free LUN until next week. The nightly backup creates a temporary thin snapshot, but the last two jobs failed. At 09:10 application writes began failing intermittently with No space left on device, although df still shows free space. Month-end close starts in six hours and the application cannot be taken offline. The audit team says it may need the five-day snapshot, but has not confirmed. You must restore write availability, preserve a recoverable state, and explain the risk.
1. Why does df show 45% while writes fail? Which commands prove the thin pool, not the filesystem, is exhausted?
Read the worked answer
df reports the filesystem inside lv_app, whose virtual size is 1.2 TB; 45% used means the filesystem has free blocks. Thin provisioning allocates physical blocks from thinpool on write. The pool is at 96% of 2 TB, so only about 80 GB remains for all 12 volumes and the snapshot's copy-on-write growth. When the pool cannot allocate a block, device-mapper returns No space left on device to the filesystem even though df looks healthy.
Prove it with lvs -a -o lv_name,lv_attr,lv_size,data_percent,metadata_percent,pool_lv,origin,devices, vgs -o vg_name,vg_size,vg_free, pvs, and dmsetup status vg_data-thinpool. Check dmesg -T for thin pool or dm errors, and confirm the mount with findmnt /srv/app. Also check metadata_percent; 18% is not critical yet, but metadata exhaustion is a separate hard failure. Do not trust df alone for thin volumes.
2. Give an ordered mitigation plan for the next six hours. State what you would not do and why.
Read the worked answer
Stop new snapshot creation and the failed backup job so COW growth does not continue; tell the business that write availability is the priority. 2. Capture
lvs,vgs,dmsetup status,df, anddmesgbefore changing anything. 3. Extend the thin pool online from the 250 GB VG free space:lvextend -L +250G vg_data/thinpool. This is online and drops pool use to about 80%, buying roughly three days at the recent 80 GB/day growth. Verify withlvsanddmsetup status.Ask audit immediately whether
snap_app_dailycan be released. If yes, confirm its origin and that no merge is pending, thenlvremove vg_data/snap_app_daily; that frees about 400 GB. If audit needs data, mount the snapshot read-only on a separate host, extract only the required files, verify them, then remove it. 5. Do notlvremovean unknown volume, do not over-extend beyondvg_free, and do not reboot; a reboot will not add pool space and may hang writes. Do not runfstrimas the emergency fix; discard can help later but is not a guaranteed immediate release. After writes are stable, schedule the new LUN and a capacity review.
3. What backup and restore validation would you require before trusting the nightly job again?
Read the worked answer
First fix the cause of the last two lvcreate snapshot failures: check dmeventd and lvm logs, free pool space, and whether the snapshot name or lock collided. A nightly backup that needs a thin snapshot must reserve enough pool headroom for both the snapshot and the day's changes; otherwise the backup itself can fill the pool. Set alerts at 70% data and 70% metadata, not 90%.
Then run a restore test to an isolated host: create the snapshot, mount it read-only or use the backup stream, restore the database and files to a scratch filesystem, run consistency checks, and compare a manifest of checksums against the source. Keep the long-term audit copy outside the production thin pool; a five-day snapshot is not a backup and its 400 GB cost is exactly the risk here. Record the restore time and retention decision, and do not re-enable the schedule until a test restore passes.