Shrink an unmounted LV containing an ext4 filesystem.
Backups are complete and the data fits within the smaller target size.
Which order is appropriate?
Shrink the upper filesystem first, then shrink the underlying LV. Reducing the LV first can cut off blocks still used by the filesystem.
Detailed explanation
Correct. Unmount and check the filesystem, shrink ext4, then reduce the LV.
Correct. Unmount and check the filesystem, shrink ext4, then reduce the LV.
Incorrect. Shrinking the LV first can discard blocks still used by ext4.
Incorrect. Shrinking the LV first can discard blocks still used by ext4.
Incorrect. Removing the VG destroys the existing layout and data.
Incorrect. Removing the VG destroys the existing layout and data.
Incorrect. The layer order and operation directions are unsafe for an existing filesystem.
Incorrect. The layer order and operation directions are unsafe for an existing filesystem.
Try it yourself
An example you can run in a temporary verification environment.
printf '%s
' 'unmount/check -> shrink filesystem -> shrink LV'Expected result
上位ファイルシステムから下位LVへ縮小する順序Key points
- Shrink upper layers first
- Take a backup and check consistency
- Some filesystems such as XFS cannot shrink
Notes
- Environment: ext4とLVM2の概念確認。実縮小は行わない
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.