pvcreate Command in Linux: Syntax, Options & Physical Volume Examples

Deepak Prasad
Tested on Ubuntu 25.04 (Plucky Puffin)
Package lvm2
lvm2
Applies to Ubuntu, Debian, RHEL, Rocky Linux, AlmaLinux, Oracle Linux, CentOS Stream, Fedora, Arch Linux, SUSE, openSUSE, Alpine
Privilege sudo or root
Man page pvcreate(8)
Scope pvcreate writes the LVM label and metadata on a disk or partition so it can join a volume group. Use it on empty block devices before vgcreate or vgextend.
Related guides lvcreate
vgextend
Linux commands

pvcreate — quick reference

Initialize physical volumes

Turn a whole disk, partition, or loop device into an LVM physical volume (PV). The device must not hold data you need — pvcreate overwrites the volume label area.

When to use Command
Initialize one block device as a PV sudo pvcreate /dev/sdX
Initialize several devices in one run sudo pvcreate /dev/sdX1 /dev/sdY1
Force creation without extra prompts sudo pvcreate -f /dev/sdX
Reinitialize a PV that belonged to a removed VG (destructive) sudo pvcreate -ff -y /dev/sdX
Set a custom PV size smaller than the device sudo pvcreate --setphysicalvolumesize 100M /dev/sdX
Skip wiping the first sectors (special layouts only) sudo pvcreate -Z n /dev/sdX
Assign a fixed PV UUID (restore/migration scripts) sudo pvcreate -u UUID /dev/sdX

Inspect PVs

After pvcreate, confirm the device appears before you build a volume group.

When to use Command
Short one-line summary per PV sudo pvs
Long list of PV attributes sudo pvdisplay /dev/sdX
Scan disks and list PVs sudo pvscan
Remove LVM metadata from a PV sudo pvremove /dev/sdX

Help and version

When to use Command
Show built-in usage pvcreate --help
Show LVM version lvm version

pvcreate — command syntax

Synopsis from pvcreate --help on Ubuntu 25.04 (LVM 2.03.27):

text
pvcreate PV ...
	[ -f|--force ]
	[ -M|--metadatatype lvm2 ]
	[ -u|--uuid String ]
	[ -Z|--zero y|n ]
	[    --setphysicalvolumesize Size[m|UNIT] ]
	[    --pvmetadatacopies 0|1|2 ]
	[ COMMON_OPTIONS ]

pvcreate writes LVM metadata on the device. It does not create partitions — prepare the disk with parted or the installer first. Most examples need sudo.


pvcreate — command examples

Essential Initialize a loop-backed physical volume

Use an image file under /tmp when you want to practice LVM without touching the system disk.

Run the commands:

bash
fallocate -l 256M /tmp/lvm-lab-a.img
sudo losetup -fP --show /tmp/lvm-lab-a.img
sudo pvcreate /dev/loop24

Sample output (loop number varies by host):

text
Physical volume "/dev/loop24" successfully created.

Confirm the PV is visible and not yet in a volume group:

bash
sudo pvs /dev/loop24

Sample output:

output
PV          VG Fmt  Attr PSize   PFree
  /dev/loop24    lvm2 ---  256.00m 256.00m

Teardown when finished: sudo pvremove -f /dev/loop24, sudo losetup -d /dev/loop24, rm /tmp/lvm-lab-a.img.

Essential Initialize two PVs for a multi-disk volume group

Create one PV per device before vgcreate spans multiple disks.

bash
fallocate -l 256M /tmp/lvm-lab-a.img /tmp/lvm-lab-b.img
LOOP_A=$(sudo losetup -fP --show /tmp/lvm-lab-a.img)
LOOP_B=$(sudo losetup -fP --show /tmp/lvm-lab-b.img)
sudo pvcreate $LOOP_A $LOOP_B
sudo pvs $LOOP_A $LOOP_B

Sample output:

output
Physical volume "/dev/loop24" successfully created.
  Physical volume "/dev/loop25" successfully created.
  PV          VG Fmt  Attr PSize   PFree
  /dev/loop24    lvm2 ---  256.00m 256.00m
  /dev/loop25    lvm2 ---  256.00m 256.00m

Both devices are ready for sudo vgcreate labvg $LOOP_A $LOOP_B.

Common Create a PV with a smaller logical size

--setphysicalvolumesize caps how much of the device LVM uses — useful when the underlying device is larger than the space you want in the VG.

bash
fallocate -l 128M /tmp/lvm-lab-c.img
LOOP_C=$(sudo losetup -fP --show /tmp/lvm-lab-c.img)
sudo pvcreate --setphysicalvolumesize 100M $LOOP_C
sudo pvs $LOOP_C

Sample output:

output
Physical volume "/dev/loop26" successfully created.
  PV          VG Fmt  Attr PSize   PFree
  /dev/loop26    lvm2 ---  100.00m 100.00m

The PV reports 100 MiB even though the loop file is 128 MiB.

Common Inspect PV details with pvdisplay and pvscan

pvs is quick; pvdisplay adds extent size and metadata layout.

bash
sudo pvdisplay /dev/loop24

Sample output (trimmed):

text
PV Name               /dev/loop24
  PV Size               256.00 MiB / not usable 4.00 MiB
  PE Size               4.00 MiB
  PV UUID               ...
  PV Write Access       read/write

List all PVs on the host:

bash
sudo pvscan

Sample output:

output
PV /dev/sda3   VG ubuntu-vg   lvm2 [<...>]
  PV /dev/loop24   VG labvg       lvm2 [252.00 MiB / ... free]
Common Remove PV metadata with pvremove

After lvremove and vgremove, wipe the PV label so the disk can be reused.

bash
sudo pvremove -f /dev/loop26
sudo losetup -d /dev/loop26
rm -f /tmp/lvm-lab-c.img

Sample output:

output
Labels on physical volume "/dev/loop26" successfully wiped.
Advanced Force reinitialization with -ff

Normally pvcreate refuses devices that still belong to a volume group. -ff wipes and recreates the PV label — only on devices you own and have removed from the VG with vgremove / pvremove.

bash
sudo vgremove -f testvg
sudo pvcreate -ff -y /dev/loop26

Sample output:

output
Physical volume "/dev/loop26" successfully created.

Never run -ff on /dev/sda*, root PVs, or ubuntu-vg members.

Advanced Whole-disk PV requires an empty partition table

pvcreate on a whole disk expects no partition table. If the disk was used before, wipe the signature first (this destroys data):

bash
sudo wipefs -a /dev/sdX
sudo pvcreate /dev/sdX

On a running system, prefer a dedicated partition (for example /dev/sdX1) or a loop file so you do not touch the boot disk.


pvcreate — when to use / when not

Use pvcreate when Use something else when
  • You have a new disk or partition and need the first LVM layer before vgcreate
  • You are adding a disk to an existing VG and want a standalone PV first (or let vgextend call pvcreate for you)
  • You are building a lab on loop files under /tmp
  • The device already belongs to a VG — use vgextend or remove the VG first
  • You only need a traditional partition without LVM — use parted / fdisk
  • You want to grow/shrink an existing LV — lvextend / lvreduce
  • The disk still holds a mounted filesystem — back up, unmount, then repartition

pvcreate vs vgcreate auto-init

pvcreate first vgcreate only
Steps Explicit PV, then VG vgcreate can initialize PVs automatically
Control Set --setphysicalvolumesize, UUID, -Z before VG Fewer commands
Best for Scripts, cloning, multi-step storage design Quick single-command setup

Either order works; many admins run pvcreate explicitly so pvs shows free PVs before grouping them.


pvcreate — interview corner

What does pvcreate do?

A physical volume is the bottom layer of LVM — a disk or partition that LVM can slice into extents. pvcreate writes the LVM label and metadata areas on that device so volume groups can claim its space.

It does not create partitions or filesystems. After pvcreate, the device shows up in pvs with free extents waiting for a VG.

A strong answer is:

"pvcreate initializes a block device as an LVM physical volume — it stamps LVM metadata so vgcreate or vgextend can pool that space into a volume group."

Can you run pvcreate on a whole disk?

Yes, if the disk has no partition table and no data you need. In practice most servers use a partition (for example /dev/sda3) so the boot partition stays outside LVM.

Whole-disk pvcreate destroys existing partition tables — the man page treats it like formatting.

A strong answer is:

"Yes on a blank whole disk, but production systems usually pvcreate on a dedicated partition so boot and EFI partitions stay separate."

When would you use pvcreate -ff?

-f forces past minor warnings; -ff allows reinitializing a device that still has stale LVM labels from an old VG. Use it only after you have removed the VG (vgremove) and confirmed the device is the correct one.

A strong answer is:

"After vgremove, -ff lets me recreate PV metadata on a disk that LVM still considers used — never on a live production PV."

How do you verify a PV was created?

Run pvs for a one-line summary, pvdisplay DEVICE for extent size and UUID, or pvscan to list all PVs on the system.

bash
sudo pvs
sudo pvdisplay /dev/sdX1

A strong answer is:

"pvs for a quick check, pvdisplay for UUID and PE size before I vgcreate or vgextend."

How do you undo pvcreate?

Remove all LVs and the VG first, then pvremove DEVICE wipes LVM labels. The disk can be repartitioned or reused.

A strong answer is:

"lvremove, vgremove, then pvremove — that clears LVM metadata without necessarily zeroing user data regions."


Troubleshooting

Symptom Likely cause Fix
Can't open /dev/sdX exclusively Device mounted or in use umount, stop MD/DM users, or pick another disk
Device /dev/sdX not found Wrong path or missing driver lsblk, rescan SCSI, check /dev/disk/by-id/
Can't initialize physical volume ... already in volume group PV still in a VG vgreduce / vgremove first, or use a new disk
Partition table exists on whole disk Partition table present Use a partition, or wipefs -a (destroys data)
unknown option Flag not in your LVM build Run pvcreate --help on the target host

Rohan Timalsina

is a technical writer and Linux enthusiast who writes practical guides on Linux commands and system administration. He focuses on simplifying complex topics through clear explanations.

  • Linux
  • HTML5
  • JavaScript
  • Web Design
  • Front-end Web Development