What it does
pvcreate DEVICE writes an LVM label and metadata area on the device, so it can join a volume group. It works on whole disks and on partitions (type lvm recommended). It refuses devices with an existing file system or partition table signature — clear them with wipefs -a first if you are sure.
pvremove deletes the LVM label from a PV that is no longer in a VG.
How to write it
pvcreate [OPTION]... DEVICE...
pvremove [OPTION]... PV...Options 27
Most used
pvcreate
Common LVM options
Nothing matches this filter.
Examples 10
$ run as a normal user# run as root (or with sudo)
1Create a PV on a partition
pvcreate /dev/vdb1 Physical volume "/dev/vdb1" successfully created.Partition type lvm first (fdisk t → lvm).
2Whole disks
pvcreate /dev/vdc /dev/vddNo partition table needed.
3Check the result
New PVs have no VG yet.
4A disk with old signatures
pvcreate /dev/vde WARNING: xfs signature detected on /dev/vde at offset 0. Wipe it? [y/n]:Answer only if the data is not needed; or run wipefs -a first.
5Test first
pvcreate -t /dev/vdcShows what would happen.
6Remove the LVM label
pvremove /dev/vdd Labels on physical volume "/dev/vdd" successfully wiped.Only after vgreduce took it out of the VG.
7Grow a PV after the disk or partition grew
pvresize /dev/vdb1The VG gets the new space (for example after a VM disk resize).
8See details of a PV
pvdisplay /dev/vdb1Size, PE count, VG.
9Find devices LVM can use
lvmdiskscanLists disks and partitions with sizes.
10Restore a lost PV label (recovery)
pvcreate --uuid "Wq3k…" --restorefile /etc/lvm/backup/vgdata /dev/vdcThen vgcfgrestore vgdata. Metadata backups are in /etc/lvm/backup.
Nothing matches this filter.
Files
/etc/lvm/lvm.conf- LVM settings.
/etc/lvm/backup/, /etc/lvm/archive/- Metadata backups.
Exit codes
0 | Done. |
5 | Error. |