-2

From We can make a disk a PV by `pvcreate`, if and only if the disk has only one partition?

You can't make the whole disk a PV if there is at least one partition on it (because pvcreate won't let you).

When considering disks and partitions as concepts in operating systems, is it correct that a disk without being partitioned is a partition by itself?

If no, what is the difference between a disk without being partitioned and a disk with only one partition?

Can pvcreate mark a disk with only one partition as a PV?

  • 1
    Partitions exist when defined by a partition table. For this reason I wouldn't consider a disk to be a partition – Torin Feb 24 at 16:52
2

A disk without being partitioned is a disk with no partitions or partition table; it’s not a partition (a partition separates something into parts, even if it’s only one; a whole disk isn’t separated into parts).

A disk with one partition is a disk with a partition table of some sort (there are several partitioning schemes), with one entry in the table defining a partition.

pvcreate can create a physical volume using an entire disk or a partition. By default it will refuse to create a physical volume using an entire disk if it already contains a partition table.

(Note that pvcreate doesn’t “mark” an existing feature — disk or partition —, it creates a physical volume, which involves writing metadata.)

  • Thanks. "By default it will refuse to create a physical volume using an entire disk if it already contains a partition table." What is non default case? – Tim Feb 24 at 18:06
  • -f or -ff IIRC. – Stephen Kitt Feb 24 at 18:56
2

They are both block storage devices. In principle one could add a partition table to a partition, thus adding partitions to it. However Operating Systems may not recursively traverse partitions, so they may no be found, and thus may not be treated the same.

Note: Extended partitions are a partition with a partition table within.

  • partition table is more like a simple kernel built-in device-mapper solution. Pretty old, but still in common use. – 炸鱼薯条德里克 Feb 25 at 1:06
  • @炸鱼薯条德里克 "partition table is more like a simple kernel built-in device-mapper solution." Is a partition table a mapping from what to what? Is LVM's device-mapper solution a mapping from what to what? – Tim Feb 26 at 4:28
  • from one physical disk to several partition block devices. from physical disks to LVs.@Tim – 炸鱼薯条德里克 Feb 26 at 4:48
1

You can't make the whole disk a PV if there is at least one partition on it (because pvcreate won't let you).

All this is saying is that pvcreate refuses to wipe out your partition table if one exists. The point of this is to prevent data loss if a user accidentally runs pvcreate /dev/sda.

If /dev/sda isn't partitioned you can run pvcreate /dev/sda to make the whole disk (even the area of the disk where a partition table would exist) a PV.

If /dev/sda is partitioned (e.g. MBR or GPT) pvcreate doesn't want to take a chance ("it won't let you"). This is a safety mechanism, not a technical limitation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.