Linux command
vgreduce 命令
安全
权限或系统影响较大,执行前请核对目标。
常用示例
Remove physical volume from volume group
sudo vgreduce [vg_name] [/dev/sdb]
Remove all empty physical volumes
sudo vgreduce -a [vg_name]
Remove missing physical volumes
sudo vgreduce --removemissing [vg_name]
Force remove missing PVs with partial LVs
sudo vgreduce --removemissing --force [vg_name]
Test removal without making changes
sudo vgreduce -t [vg_name] [/dev/sdb]
说明
vgreduce removes physical volumes from a volume group, reducing its capacity. The removed physical volumes can then be used in other volume groups or removed from the system entirely. Before removal, ensure the physical volume contains no data by checking with pvdisplay. If data exists, use pvmove to migrate it to other physical volumes first. After vgreduce, use pvremove to clean LVM metadata from the disk. The --removemissing option handles failed disks that are no longer present. Combined with --force, it removes any logical volumes that had data on the missing disk.
参数
- -a, --all
- Remove all empty physical volumes.
- --removemissing
- Remove missing (failed) physical volumes.
- --mirrorsonly
- Only remove missing PVs from mirror LVs.
- -f, --force
- Force removal, removing partial LVs if needed.
- -t, --test
- Test mode; don't make changes.
- -v, --verbose
- Verbose output.
- -y, --yes
- Answer yes to prompts.
FAQ
What is the vgreduce command used for?
vgreduce removes physical volumes from a volume group, reducing its capacity. The removed physical volumes can then be used in other volume groups or removed from the system entirely. Before removal, ensure the physical volume contains no data by checking with pvdisplay. If data exists, use pvmove to migrate it to other physical volumes first. After vgreduce, use pvremove to clean LVM metadata from the disk. The --removemissing option handles failed disks that are no longer present. Combined with --force, it removes any logical volumes that had data on the missing disk.
How do I run a basic vgreduce example?
Run `sudo vgreduce [vg_name] [/dev/sdb]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -a, --all do in vgreduce?
Remove all empty physical volumes.