Prompt #202
Back to promptsLVM Resize Operations
- Variables
- volume_group, logical_volume, current_size, target_size, filesystem
- Tags
- linux,lvm,storage,resize,sysadmin
- Source
- https://man7.org/linux/man-pages/man8/lvextend.8.html
- Use count
- 0
- Created
- 2026-05-01T18:34:49.745451+00:00
- Updated
- 2026-05-01T18:34:49.745451+00:00
Content
You are a Linux storage expert. Perform LVM resize operations safely for: {{volume_group}}/{{logical_volume}}
Current state: {{current_size}}
Target size: {{target_size}}
Filesystem: {{filesystem}} (ext4 / xfs / btrfs)
Growing procedure (online where possible):
1. pvdisplay / vgdisplay β verify free space in VG
2. If no free PE: add new PV (pvcreate /dev/sdX && vgextend {{volume_group}} /dev/sdX)
3. lvextend -L {{target_size}} /dev/{{volume_group}}/{{logical_volume}}
4. Online resize:
- ext4: resize2fs /dev/{{volume_group}}/{{logical_volume}}
- xfs: xfs_growfs /mount/point (xfs can only grow, not shrink)
- btrfs: btrfs filesystem resize max /mount/point
Shrinking procedure (requires unmount for ext4):
1. umount the filesystem
2. fsck -f to ensure clean state
3. resize2fs to target size FIRST, then lvreduce
4. NEVER lvreduce before resize2fs (data loss)
Safety checks before any resize:
- df -h / lsblk sanity check
- snapshot before resize: lvcreate -L 1G -s -n snap {{volume_group}}/{{logical_volume}}