5 pvcreate command examples in Linux [Cheat Sheet]


Reviewer: Deepak Prasad

Introduction to pvcreate command

pvcreate command initializes a disk or partition as a physical volume. The physical volumes are used to create a volume group and the LVM logical volumes are created on the volume groups.


Are you new to LVM and still learning how it works?

We have written detailed articles covering different areas of managing logical volumes, which you can follow using the below links:

Manage Logical Volume in Linux - One STOP Solution
Understand LVM Architecture
Create LVM during installation RHEL/CentOS 7/8
How to use LVM Snapshot for Backup and Restore
Create Mirrored Logical Volume
Create Striped Logical Volume


Different examples to use pvcreate command

pvcreate initializes a physical volume on a device. A physical volume can be created using a whole device or partition. An LVM disk label is written to the device, and LVM metadata areas are initialized.


1. pvcreate command to initialize a block device

The following command initializes /dev/sdc  as a physical volume for later use by LVM logical volumes. Initialization is similar to formatting a file system.

# pvcreate /dev/sdc

Sample Output:

root@ubuntu-PC:~# pvcreate /dev/sdc
  Physical volume "/dev/sdb" successfully created.


If you are creating a physical volume using a whole disk device, the disk must have no partition table. The partition table must be erased, which will effectively destroy all data on that disk.


2. pvcreate command to initialize the partition

You can run the pvcreate command on the partition to initialize partitions rather than whole disks.

The following command initializes the partition /dev/sda1 and /dev/sdb1 as LVM physical volumes.

# pvcreate /dev/sda1 /dev/sdb1

Sample Output:

root@ubuntu-PC:~# pvcreate /dev/sda1 /dev/sdb1
  Physical volume "/dev/sda1" successfully created.
  Physical volume "/dev/sdb1" successfully created.


3. Display physical volumes in the system

There are three commands you can use to display properties of physical volumes: pvs, pvdisplay, and pvscan.

pvs produces formatted output about physical volumes.

pvs command to display physical volumes

pvdisplay command displays attributes of physical volumes like name, size, physical extent size, space used for the volume group, and so on.

pvdisplay command to display attributes of physical volumes

pvscan scan all LVM supported disks for physical volumes and shows them.

pvscan command to scan all disks for physical volumes

You can use vgcreate command to create a new volume group on one or more physical volumes.

We have written a detailed article on vgcreate command examples in Linux [Cheat Sheet].


4. Force the creation of physical volumes

The -f or --force options force the creation of the physical volume without any confirmation.

Normally, you cannot reinitialize the physical volumes belonging to an existing volume group. But with option -ff, you can override this behaviour and recreate the physical volume.

# pvcreate -ff /dev/sdb1

Sample Output:

pvcreate command to force the creation of physical volume

If you want to remove the physical volume, you can use pvremove command.

root@ubuntu-PC:~# pvremove /dev/sdb1
  Labels on physical volume "/dev/sdb1" successfully wiped.


5. Set physical volume size

By default, pvcreate automatically detects the size for the physical volume. You can use --setphysicalvolumesize option to set your own custom size for the physical volume.

# pvcreate --setphysicalvolumesize SIZE /dev/sdb1

Sample Output:

The default unit is megabytes. You can use K for kilobytes, M for megabytes, G for gigabytes, T for terabytes, P for petabytes or E for exabytes.

pvcreate command to set physical volume size



This tutorial teaches you to create physical volumes and display their properties in the Linux system. If you have any confusion, please let us know in the comment section below.


What's Next

10+ lvcreate command examples in Linux [Cheat Sheet]
How to PROPERLY use lvextend to increase LV size


Further Reading

man page for pvcreate command


Views: 1,228
Rohan Timalsina

Rohan Timalsina

He is proficient in a wide range of skills, including Page Builder Plugins such as Elementor, Beaver Builder, Visual Composer, and Divi Builder. His expertise extends to Front End Development with HTML5/CSS3, JavaScript, Bootstrap, and React.js. You can connect with him on his LinkedIn profile.

Can't find what you're searching for? Let us assist you.

Enter your query below, and we'll provide instant results tailored to your needs.

If my articles on GoLinuxCloud has helped you, kindly consider buying me a coffee as a token of appreciation.

Buy GoLinuxCloud a Coffee

For any other feedbacks or questions you can send mail to admin@golinuxcloud.com

Thank You for your support!!

Leave a Comment