问题原文
原帖链接 · Andreas Wederbrand · CC BY-SA 4.0
I'm using LVM on a single disk and now I need to resize the partition (sda2) I'm using.
I've already resized the Logical Volume but I can't manage to shrink the Volume Group. I know that vgreduce can remove Physical Volumes entirely but I have only one and I need too shrink that one.
Is it possible?
已采纳解答
原帖链接 · John Mahowald · CC BY-SA 4.0
Assuming Linux LVM.
Reducing the size of a PV, and keeping the same PV partition, is a multiple step process. A little bit dangerous, data corruption is possible if the volumes are reduced too small for the file system.
- Backup data.
- Reduce the size of the file system. This is not possible for XFS, in which case you will need an alternative solution like restore backups to a smaller volume.
lvreduce --resizefs --sizethe LV.--resizefsdoes step #2 at the same time, ensuring the sizes match.pvresize --setphysicalvolumesizethe PV.- Re-partition the PV. Tricky on the PV that contains the root file system. May be necessary to reboot into a rescue enviornment with root not mounted and VG not activated.
vgreduce removes entire PVs from the VG, and is not useful in this example.
As an alternative, if you move to using entire disks and not partitions, this process can be simpler.
- Backup data.
lvreduce --resizefs --sizeif necessary to fit in the new disk- Create disk, say it is named /dev/sdb
vgextend /dev/sdbpvmove /dev/sda1vgreduce /dev/sda1
End result, VG moved to new disk, old partition empty and can be deleted.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
