how to use pvcreate command with its examples

  • About pvcreate:  To initialize a disk or partition for use by LVM
  • Comes From: lvm2-2.02.72
  • Configuration Files:
  • Path: /sbin/pvcreate

Examples:

1. To create a physical volume out of partition or drive

$ pvcreate /dev/sda

 2. To forcefully create the physical volume

$ pvcreate -f /dev/sda1
$ pvcreate –force /dev/sda1 

3. To Specify the uuid for the device

$ pvcreate -u e24b38c3-d57e-4903-b6dd-d002c5a8fd0f 
$ pvcreate –uuid e24b38c3-d57e-4903-b6dd-d002c5a8fd0f  

4. To answer yes to all questions

$ pvcreate -y /dev/sda1

 5. To specify if the first 4 sectors of device should be wiped or not

$ pvcreate -Z y
$ pvcreate –zero y 

6. To specify the amount space to be set aside for metadata

$ pvcreate –metadatasize

 7. To Align the start of the data to a multiple of this number

$ pvcreate –dataalignment 4

 8. To specify the number of metadata areas to set aside on each PV

$ pvcreate –[pv]metadatacopies 2

 9. To ignore or un-ignore metadata areas on this physical volume

$ pvcreate –metadataignore y 

10. To extracts the location and size of the data on the PV from the file

$ pvcreate –restorefile file 

11. To allows a uuid to be  specified  without also requiring that a backup of the metadata be provided

$ pvcreate –norestorefile

12. To different sector near  the  start  of  the  disk to label the PV

$ pvcreate –labelsector sector

13. To overrides the automatically-detected size of the PV

$ pvcreate –setphysicalvolumesize size

Related Commands: lvm.conf,  lvm,  vgcreate,  vgextend, lvcreate, cfdisk, fdisk, losetup, mdadm, vgcfgrestore, vgconvert 

Leave a Reply

Your email address will not be published. Required fields are marked *