Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the use of the pvcreate command in Linux

2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article is to share with you about the use of the pvcreate command in Linux. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

The Linux common command pvcreate command is used to initialize a physical hard disk partition to a physical volume for use by LVM.

Pvcreate initializes physical hard disk partitions to physical volumes

Syntax pvcreate (option) (parameter) option-f: force the creation of a physical volume without user confirmation;-u: specify the UUID;-y of the device: all questions are answered "yes";-Z: whether to use the first four sectors. Parameter physical volume: specifies the device file name for the physical volume to be created.

Instance to view disk information:

[root@localhost] # fdisk-l Disk / dev/hda: 41.1 GB, 41174138880 bytes 255heads, 63 sectors/track 5005 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks id System / dev/hda1 * 1 13 104391 83 Linux / dev/hda2 14 1288 10241437 + 83 Linux / dev/hda3 1289 1925 5116702 + 83 Linux / dev/hda4 1926 5005 24740100 5 Extended / dev/hda5 1926 2052 1020096 82 Linux swap / Solaris / dev/hda6 2053 2235 1469916 8e Linux LVM / dev/hda7 2236 2418 1469916 8e Linux LVM / dev/hda8 2419 2601 1469916 8e Linux LVM / dev/hda9 2602 2784 14699168e Linux LVM check for PV on the system Then build / dev/hda6 to / dev/hda9 into PV format

[root@localhost ~] # pvscan No matching physical volumes found # can't find any PV! Convert partition 6-9 to pv, and note the use of curly braces:

[root@localhost] # pvcreate / dev/hda {6 PV 7 8 Jing 9} Physical volume "/ dev/hda6" successfully created Physical volume "/ dev/hda7" successfully created Physical volume "/ dev/hda8" successfully created Physical volume "/ dev/hda9" successfully created this represents the information of each PV and all the PV information of the system respectively:

[root@localhost ~] # pvscan PV / dev/hda6 lvm2 [1.40 GB] PV / dev/hda7 lvm2 [1.40 GB] PV / dev/hda8 lvm2 [1.40 GB] PV / dev/hda9 lvm2 [1.40 GB] Total: 4 [5.61 GB] / in use: 0 [0] / in no VG: 4 [5.61 GB] more detailed list of each PV information on the system:

[root@localhost ~] # pvdisplay "/ dev/hda6" is a new physical volume of "1.40 GB"-NEW Physical volume-PV Name / dev/hda6 # the actual partition partition name VG Name # is blank because it has not been assigned yet! PV Size 1.40 GB # is the capacity indicating whether Allocatable NO # has been allocated The result is that NO PE Size (KByte) 0 # PE size Total PE 0 # in this PV is divided into several PE free PE 0 # PE Allocated PE 0 # used by LV and the number of PE that can still be allocated PV UUID Z13Jk5-RCls-UJ8B-HzDa-Gesn-atku-rf2biN. (omitted below). Delete the physical volume:

[root@localhost ~] # pvremove / dev/sdb2 Labels on physical volume "/ dev/sdb2" successfully wiped modifies physical volume attributes:

[root@localhost ~] # pvchange-x n / dev/sdb1 # forbids the allocation of PEPhysical volume "/ dev/sdb1" changed 1 physical volume changed / 0 physical volumes not changed on the specified physical volume. Thank you for reading! This is the end of this article on "what is the use of pvcreate commands in Linux?". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report