Linux command
lvmdevices 命令
安全
权限或系统影响较大,执行前请核对目标。
常用示例
List devices
sudo lvmdevices
Add a device
sudo lvmdevices --adddev [/dev/sdXN]
Remove a device
sudo lvmdevices --deldev [/dev/sdXN]
Add a physical volume
sudo lvmdevices --addpvid [PVID]
Remove a physical volume
sudo lvmdevices --delpvid [PVID]
Update
sudo lvmdevices --update
Check
sudo lvmdevices --check
Example
lvmdevices --version
说明
lvmdevices manages the LVM devices file that controls which block devices LVM can use as physical volumes. Located at /etc/lvm/devices/system.devices, this file restricts LVM to scanning only listed devices, improving performance and preventing accidental use of unintended disks. When devices are added or removed, or when device names change (e.g., after hardware changes), lvmdevices can update the devices file accordingly. The --check option validates that listed devices exist and are accessible. The devices file uses stable device identifiers (WWID, serial numbers) rather than potentially changing paths like /dev/sdX, ensuring consistent behavior across reboots.
参数
- --adddev _device_
- Add a device to the LVM devices file by path
- --deldev _device_
- Remove a device from the devices file by path
- --addpvid _PVID_
- Add a physical volume by its unique PVID
- --delpvid _PVID_
- Remove a physical volume by its PVID
- --update
- Update the devices file to reflect changed device names
- --check
- Verify the devices file and report problems
- --version
- Display version information
FAQ
What is the lvmdevices command used for?
lvmdevices manages the LVM devices file that controls which block devices LVM can use as physical volumes. Located at /etc/lvm/devices/system.devices, this file restricts LVM to scanning only listed devices, improving performance and preventing accidental use of unintended disks. When devices are added or removed, or when device names change (e.g., after hardware changes), lvmdevices can update the devices file accordingly. The --check option validates that listed devices exist and are accessible. The devices file uses stable device identifiers (WWID, serial numbers) rather than potentially changing paths like /dev/sdX, ensuring consistent behavior across reboots.
How do I run a basic lvmdevices example?
Run `sudo lvmdevices` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does --adddev _device_ do in lvmdevices?
Add a device to the LVM devices file by path