-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?

Tim
  • 101,790
  • 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 '19 at 16:52

3 Answers3

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 '19 at 01: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 '19 at 04:28
  • from one physical disk to several partition block devices. from physical disks to LVs.@Tim – 炸鱼薯条德里克 Feb 26 '19 at 04:48
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.)

Stephen Kitt
  • 434,908
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.

el_tigro
  • 236