Skip to content
CloudOps
Newsletter
All prompts
AI for Linux Admins Difficulty: Advanced ClaudeChatGPT

LVM Thin Provisioning & Online Resize Planning Prompt

Plan LVM thin pools and online filesystem grows safely — pool sizing, metadata, overprovisioning monitoring, and a step-by-step PV→VG→LV→filesystem resize that won't lose data.

Target user
Linux admins managing LVM storage on production servers
Difficulty
Advanced
Tools
Claude, ChatGPT

The prompt

You are a Linux storage engineer who plans LVM changes on production volumes where a wrong order of operations means data loss.

I will provide:
- Current layout: `pvs`, `vgs`, `lvs -a -o +seg_type`, and `lsblk`
- Filesystem types on each LV (ext4, XFS) and mount points
- The goal (grow an LV, build a thin pool, add a disk, reclaim space)
- Free space available (unallocated extents, new disk, cloud volume)
- Whether downtime is acceptable

Your job:

1. **Read the current state** — summarize PVs, VGs, LVs, free extents, and whether any LV is already thin-provisioned. Flag a nearly-full VG or thin pool before doing anything else.

2. **Thin pool design (if applicable)** — size the data LV and the separate metadata LV (and why metadata exhaustion freezes a pool harder than data exhaustion), choose chunk size, set `--poolmetadatasize`, and enable autoextend (`thin_pool_autoextend_threshold`/`_percent` in `lvm.conf`).

3. **Overprovisioning safety** — the monitoring that must exist before you overcommit: alert on data% and metadata% of the pool, what happens when a thin pool hits 100% (writes fail / FS goes read-only), and recovery options.

4. **The exact resize sequence** — for growing an LV: extend PV/VG if needed (`pvresize`, `vgextend`), then `lvextend`, then grow the filesystem (`resize2fs` for ext4, `xfs_growfs` for XFS — XFS cannot shrink). Use `lvextend -r` to do LV+FS in one step where supported. Spell out the order; growing the FS before the LV is the classic mistake.

5. **Shrink caveats** — ext4 can shrink (unmount, `e2fsck`, `resize2fs` smaller, then `lvreduce`), XFS cannot. Warn loudly that shrink order is the reverse of grow and a single transposed step truncates data.

6. **Verification & backout** — confirm with `lvs`/`df -h`, and note that online grows are low-risk while any shrink should have a fresh backup.

Output as: (a) current-state summary with risk flags, (b) the exact ordered command sequence with each command annotated, (c) the monitoring/autoextend config for thin pools, (d) a verification checklist.

Bias toward: grow online when possible, never shrink XFS, back up before any reduce, and always size thin-pool metadata generously.
Newsletter

Free: the DevOps AI Incident-Triage Cheat Sheet

Subscribe and we’ll send you the one-page cheat sheet — plus weekly AI prompts, automation ideas, and tool reviews for infrastructure engineers. One email a week. No spam, unsubscribe anytime.

  • AI Incident-Triage Cheat Sheet (PDF)
  • Access to 1,603 DevOps AI prompts
  • One practical workflow email per week