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. ]
저자 소개
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.
유사한 검색 결과
Slash VM provisioning time on Red Hat Openshift Virtualization using Red Hat Ansible Automation Platform
Red Hat Ansible Automation Platform: Measuring Business Impact with Dashboard and Analytics
Technically Speaking | Taming AI agents with observability
You Can’t Automate Collaboration | Code Comments
채널별 검색
오토메이션
기술, 팀, 인프라를 위한 IT 자동화 최신 동향
인공지능
고객이 어디서나 AI 워크로드를 실행할 수 있도록 지원하는 플랫폼 업데이트
오픈 하이브리드 클라우드
하이브리드 클라우드로 더욱 유연한 미래를 구축하는 방법을 알아보세요
보안
환경과 기술 전반에 걸쳐 리스크를 감소하는 방법에 대한 최신 정보
엣지 컴퓨팅
엣지에서의 운영을 단순화하는 플랫폼 업데이트
인프라
세계적으로 인정받은 기업용 Linux 플랫폼에 대한 최신 정보
애플리케이션
복잡한 애플리케이션에 대한 솔루션 더 보기
가상화
온프레미스와 클라우드 환경에서 워크로드를 유연하게 운영하기 위한 엔터프라이즈 가상화의 미래