Pvcreate vs disk partioning

Hi,

Case1 ) When a new disk is added ( ex: /dev/sda ), After scanning we create 1 partition for the whole disk ( ex: /dev/sda1 ) and then pvcreate and then add to a volume group.

Query )

  1. We can do directly pvcreate on the whole disk also

So, what is the difference between

  1. pvcreate after creating a single partition on whole disk
  2. pvcreate on the whole disk ( without partition )

In both cases - it works fine though.....

Hi.

From the topic at Initializing disks or disk partitions

Note, however, that the HOWTO is years old. I don't know whether there is newer advice. The advice above still seems to make sense to me.

In my situation, I place a single partition on a disk, then incorporate that into a RAID1 (or RAID10 if I have enough disks), then I place LVM on top of that.

Perhaps someone will stop by with additional information.

Best wishes ... cheers, drl

1 Like

Thanks for the link...When i started looking for answer i came across this link and the below one as well

https://access.redhat.com/site/documentation/en-US/Red\_Hat\_Enterprise\_Linux/5/html/Logical\_Volume\_Manager\_Administration/physvol_admin.html

4.2.1.1. Setting the Partition Type
If you are using a whole disk device for your physical volume, the  disk must have no partition table. 
For DOS disk partitions, the  partition id should be set to 0x8e using the fdisk or cfdisk  command or 
an equivalent. For whole disk devices only the partition  table must be erased, which will effectively 
destroy all data on that  disk. You can remove an existing partition table by zeroing the first  sector 
with the following command: 				
# dd if=/dev/zero of=PhysicalVolume bs=512 count=1

4.2.1.2. Initializing Physical Volumes

Use the pvcreate command to initialize a block device to be used as a physical volume. Initialization
 is analogous to formatting a file system. 				

Still not much information to draw a conclusion....

By adding whole disk /dev/sda using pvcreate, You can't create other physical volumes on the /dev/sda.

If you create partitions and create physical volumes using pvcreate, You can add other physical volumes of /dev/sda to increase its space.This is called Efficient Disk Space management.
This means you need to depend on other disks like /dev/sdb or /dev/sdc or etc..

:slight_smile: