← 返回命令列表

Linux command

vgscan 命令

安全

权限或系统影响较大,执行前请核对目标。

常用示例

Scan for all volume groups

sudo vgscan

Scan and recreate missing device nodes

sudo vgscan --mknodes

Scan with verbose output

sudo vgscan -v

Scan in test mode without updating metadata

sudo vgscan -t

说明

vgscan scans all supported LVM block devices in the system for volume groups. It builds the LVM cache file that holds current information about volume groups on the system. On modern LVM2 systems, volume group scans happen automatically when changes are made. Manual use of vgscan is mainly needed after hardware changes or to rebuild the cache.

参数

--mknodes
Check and recreate LVM special device files in /dev. Creates missing nodes and removes unused ones.
-v, --verbose
Verbose mode. Repeat up to 4 times to increase detail.
--notifydbus
Send a notification to D-Bus after the scan completes.
--reportformat _basic|json_
Override the output format for reports.
--ignorelockingfailure
Continue with read-only metadata operations after locking failures.
-t, --test
Run in test mode without updating metadata.
-d, --debug
Set debug level. Repeat up to 6 times to increase detail.
-q, --quiet
Suppress output and log messages.

FAQ

What is the vgscan command used for?

vgscan scans all supported LVM block devices in the system for volume groups. It builds the LVM cache file that holds current information about volume groups on the system. On modern LVM2 systems, volume group scans happen automatically when changes are made. Manual use of vgscan is mainly needed after hardware changes or to rebuild the cache.

How do I run a basic vgscan example?

Run `sudo vgscan` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --mknodes do in vgscan?

Check and recreate LVM special device files in /dev. Creates missing nodes and removes unused ones.