Linux command
lvreduce 命令
安全
权限或系统影响较大,执行前请核对目标。
常用示例
Example
sudo lvreduce -L 120G [logical_volume]
Example
sudo lvreduce -L -40G --resizefs [logical_volume]
Example
sudo lvreduce -l -3 [vg00/lvol1]
Test
sudo lvreduce -t -L -10G [logical_volume]
说明
lvreduce reduces the size of a logical volume. The freed logical extents are returned to the volume group to be used by other logical volumes. This is a destructive operation -- data in the reduced area is lost. You should ensure that any filesystem on the volume is resized before running lvreduce so that the extents to be removed are not in use, unless using the --resizefs option.
参数
- -L, --size _SIZE_k|m|g|t
- New absolute size, or with a leading minus sign, the amount to subtract from the current size. Accepts size suffixes: k (KiB), m (MiB), g (GiB), t (TiB).
- -l, --extents -_Number_%{VG|FREE|PVS|ORIGIN}
- New size in logical extents, or relative reduction with minus prefix. Supports percentage suffixes: %VG (of VG size), %FREE (of VG free space), %PVS (of specified PVs).
- -r, --resizefs
- Resize the underlying filesystem together with the logical volume using fsadm(8).
- -f, --force
- Force size reduction without prompting, even when it may cause data loss.
- -n, --nofsck
- Skip the filesystem check before resizing.
- -y, --yes
- Do not prompt for confirmation; always assume yes.
- -t, --test
- Run in test mode; commands will not update metadata.
- -A, --autobackup {y|n}
- Automatically back up metadata after a change.
FAQ
What is the lvreduce command used for?
lvreduce reduces the size of a logical volume. The freed logical extents are returned to the volume group to be used by other logical volumes. This is a destructive operation -- data in the reduced area is lost. You should ensure that any filesystem on the volume is resized before running lvreduce so that the extents to be removed are not in use, unless using the --resizefs option.
How do I run a basic lvreduce example?
Run `sudo lvreduce -L 120G [logical_volume]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -L, --size _SIZE_k|m|g|t do in lvreduce?
New absolute size, or with a leading minus sign, the amount to subtract from the current size. Accepts size suffixes: k (KiB), m (MiB), g (GiB), t (TiB).