Physical volumes (PV
) are the base "block" that you need in order to manipulate a disk using Logical Volume Manager (LVM
).
Now, let’s not rush ahead. What exactly is a physical volume? What in the world is LVM?
In short, LVM is a type of storage virtualization that allows operators far more flexibility in storage management than standard partitioning. A physical volume is any physical storage device, such as a Hard Disk Drive (HDD
), Solid State Drive (SSD
), or partition, that has been initialized as a physical volume with LVM. Without properly initialized physical volumes, you cannot create Volume Groups or logical volumes.
So let's get started! First, there are a few considerations.
Don't try to pinpoint the exact amount of space you need down to the nearest byte. The reason for this is that LVM places labels on the physical volumes' UUID
, as well as metadata storage. While this doesn't take up very much space, understand that if you initialize a 1Gb PV, you do not have 1Gb of usable space.
Also, although LVM allows you to create physical volumes using multiple partitions, it is recommended that you use a single partition for a PV. This is for a couple of reasons—single partitions are easier to track for sysadmins, and you will experience better Striping performance. For more info on this, see Red Hat Documentation.
Initializing physical volumes
So, now that we have considered our options, let’s look at the actual initialization process. It is always good practice to see what physical volumes you already have configured on your system. To do this, use the pvs
command. You should get something similar to this:
[root@rhel ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 rhel lvm2 a-- <29.00g 0
Here we can see that my VM only has a single physical volume /dev/sda2
that is 29.00Gb. Let's create two additional PVs at 1Gb to demonstrate the process:
[root@rhel ~]# pvcreate /dev/sdb /dev/sdc
Physical volume "/dev/sdb" successfully created.
Physical volume "/dev/sdc" successfully created.
You can verify the creation worked using the pvdisplay
command:
[root@rhel ~] # pvdisplay
--- Physical volume ---
PV Name /dev/sda2
VG Name rhel
PV Size <29.00 GiB / not usable 3.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 7423
Free PE 0
Allocated PE 7423
PV UUID q9VFt3-YR0m-XATY-BADn-Vbnb-PVl5-9wIAhd
"/dev/sdb" is a new physical volume of "1.00 GiB"
--- NEW Physical volume ---
PV Name /dev/sdb
VG Name
PV Size 1.00 GiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID 3MHooU-799T-xe8q-24Jk-MMdc-pkhF-Tnqpbg
"/dev/sdc" is a new physical volume of "1.00 GiB"
--- NEW Physical volume ---
PV Name /dev/sdc
VG Name
PV Size 1.00 GiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID ydegao-MGb8-X5Mc-VuLp-JnFH-vmx9-rYa9wQ>
However, I find that in most use cases, the pvs
command is much more reader-friendly:
[root@rhel ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 rhel lvm2 a-- <29.00g 0
/dev/sdb lvm2 --- 1.00g 1.00g
/dev/sdc lvm2 --- 1.00g 1.00g>
Wrap up and troubleshooting
If you were able to follow those steps successfully, congratulations on initializing a physical volume! If not, be sure that your new drives or partitions are formatted but NOT mounted prior to using the pvcreate
command. Otherwise, you will see the following error:
[root@rhel ~]# pvcreate /dev/sdb /dev/sdc
Can't open /dev/sdb exclusively. Mounted filesystem?
Can't open /dev/sdc exclusively. Mounted filesystem?
I hope that this quick look at physical drive creation was helpful. Next, I recommend that you try creating a volume group using vgcreate
. More on that in a future article!
[ Free online course: Red Hat Enterprise Linux technical overview. ]
À propos de l'auteur
Tyler is the Sr. Community Manager at Enable Sysadmin, a submarine veteran, and an all-round tech enthusiast! He was first introduced to Red Hat in 2012 by way of a Red Hat Enterprise Linux-based combat system inside the USS Georgia Missile Control Center. Now that he has surfaced, he lives with his wife and son near Raleigh, where he worked as a data storage engineer before finding his way to the Red Hat team. He has written numerous technical documents, from military procedures to knowledgebase articles and even some training curricula. In his free time, he blends a passion for hiking, climbing, and bushcraft with video games and computer building. He is loves to read and enjoy a scotch or bourbon. Find him on Twitter or on LinkedIn.
Contenu similaire
Parcourir par canal
Automatisation
Les dernières nouveautés en matière d'automatisation informatique pour les technologies, les équipes et les environnements
Intelligence artificielle
Actualité sur les plateformes qui permettent aux clients d'exécuter des charges de travail d'IA sur tout type d'environnement
Cloud hybride ouvert
Découvrez comment créer un avenir flexible grâce au cloud hybride
Sécurité
Les dernières actualités sur la façon dont nous réduisons les risques dans tous les environnements et technologies
Edge computing
Actualité sur les plateformes qui simplifient les opérations en périphérie
Infrastructure
Les dernières nouveautés sur la plateforme Linux d'entreprise leader au monde
Applications
À l’intérieur de nos solutions aux défis d’application les plus difficiles
Programmes originaux
Histoires passionnantes de créateurs et de leaders de technologies d'entreprise
Produits
- Red Hat Enterprise Linux
- Red Hat OpenShift
- Red Hat Ansible Automation Platform
- Services cloud
- Voir tous les produits
Outils
- Formation et certification
- Mon compte
- Assistance client
- Ressources développeurs
- Rechercher un partenaire
- Red Hat Ecosystem Catalog
- Calculateur de valeur Red Hat
- Documentation
Essayer, acheter et vendre
Communication
- Contacter le service commercial
- Contactez notre service clientèle
- Contacter le service de formation
- Réseaux sociaux
À propos de Red Hat
Premier éditeur mondial de solutions Open Source pour les entreprises, nous fournissons des technologies Linux, cloud, de conteneurs et Kubernetes. Nous proposons des solutions stables qui aident les entreprises à jongler avec les divers environnements et plateformes, du cœur du datacenter à la périphérie du réseau.
Sélectionner une langue
Red Hat legal and privacy links
- À propos de Red Hat
- Carrières
- Événements
- Bureaux
- Contacter Red Hat
- Lire le blog Red Hat
- Diversité, équité et inclusion
- Cool Stuff Store
- Red Hat Summit