7

All. Forgive me I not familiar with the Linux. I am trying to install CentOS in the VMWare. As I knew, Linux can only create three kinds of partitions. they are primary, extended, and logical, For MBR, the max numbers of primary and extended partition are 4. and The unlimited numbers of logical partitions can be created under the extended partition. (If I was wrong. Please correct me. Thanks.)

But As to the CentOS. I got the options like below when creating the partitions. Compare to the concept of primary, extended, and logical, I can't understand Standard partition and LVM physical volume and didn't know what is the difference between them. What does it mean creating an LVM physical volume? Could anyone please tell me more about it ?

Thanks.

enter image description here

6

As I knew, Linux can only create three kinds of partitions. they are primary, extended, and logical

No, that's wrong. What you're describing here is PC old-style “MBR” partitions. This was the standard partition type on PC-type computers (and some others) since the 1980s but these days it's being replaced by GUID partitions. Logical vs primary partition is a hack due to the limitations of this 1980s system which you can ignore if you don't have to deal with older systems.

Using a standard partition system is essential if you have multiple operating systems installed on the same disk. Otherwise, you don't have to. Furthermore, even with multiple operating systems, you can use a single standard partition for Linux, and use Linux's own partitioning system inside it.

LVM is Linux's native partitioning system. It has many advantages over MBR or GUID partitions, in particular the ability to move or even spread partitions between disks (without unmounting anything), and to resize partitions easily. Use LVM for Linux by preference.

LVM achieves its flexibility by combining several levels of abstraction. A physical storage area, typically a PC-style partition, is a physical volume. The space of one or more physical volume makes up a volume group. In a volume group, you create logical volumes, each containing a filesystem (or a swap volume, etc.).

  • Thank you telling about the LVM and correct me. I just read some about MBR and GPT. howtogeek.com/193669/…. Does it mean Linux (let's say CentOS) support both MBR and GPT? How can I partition with GPT in CentOS? – Joe.wang Jun 28 '16 at 6:21
  • And from your answer . Did you mean LVM doesn't belong to both (MBR and GPT)? – Joe.wang Jun 28 '16 at 6:50
  • 1
    @Joe.wang Linux supports both MBR and GPT (and many other more exotic partition types, it's very accommodating). I don't know how to select between MBR and GPT in the CentOS installer. Recent versions of the fdisk utility let you choose, and if your fdisk is too old you might have gdisk for GPT partitions. LVM is a different thing, LVM is a Linux-only partitioning system. – Gilles Jun 28 '16 at 12:37
  • Great explain. Thank you for you kind and generous help.+1 – Joe.wang Jun 28 '16 at 13:38
0

If you are not sure whether you need the lvm physical partition or not , then just create the standard partition.

The lvm physical volume (pv) is just a standard partition (with lvm meta data) to be used in lvm volume group (vg) from which a logical volume (lv) can be created , and the final logical volume is just like a block device where you can write a file system and mount it somewhere.

0

A logical partition is different from LVM which stands for logical volume manager.

First clarifying what logical partition is, they are simply partitions within an Extended partition, which is just like a Primary partition except you can sub-partition it and fill it with infinite logical partitions.

As you may have noticed, PC hard disks only allowed 4 (primary) partitions, and since we often need more, extended partitions were invented, which allows us to add as many sub partitions as we want.

here's an example of mixed primary and extended partitioning: (p)=primary (e)=extended (l)=logical

/dev/sda 1G

==>/dev/sda1(p) 250M

==>/dev/sda2(e) 1k

==>/dev/sda5(l) 125M    

==>/dev/sda6(l) 125M

==>/dev/sda3(p) 250M

==>/dev/sda4(p) 250M

Moving on. LVM or Logical Volume Manager, is a separate layer from partitioning. LVM uses physical volumes (PV) that are actual partitions on hard disks inside volume groups (VG), which can be considered as a "whole disk", of which you can "partition" with Logical Volumes (LV). The advantage of this is for easy storage expansion/shrinkage.

illustration of LVM:

Physical disks;

disk1(/dev/sda, see above for all its partitions) disk2(/dev/sdb): /dev/sdb 1G
==>/dev/sdb1(p) 1G

LVM:

create PV for all the physical partitions (pvcreate /dev/sdx#):

VG1 (vgcreate VG1 /dev/sda1 /dev/sda3 /dev/sdb1): /dev/sda1+/dev/sda3+/dev/sdb1

VG2 (vgcreate VG2 /dev/sda4 /dev/sda5 /dev/sda6): /dev/sda4+/dev/sda5+/dev/sda6

LV1 (lvcreate -l 1400M /dev/VG1): Here you have a 1400M partition residing on /dev/VG1; On here you can create a filesystem like you would on a normal partition.

Personally I like to think of LVM as a virtual hard disk system using a bricks-build-the-wall model to manages disk drives with the Linux kernel's device mapper. Logical Volume (LVs) is the wall, Volume group (VGs) is the pile of bricks that you picked to build your wall, and Physical Volume (PVs) are the bricks themselves (which can come in difference sizes and shapes). On the other hand disk partitions are the painted grids on the wall, where you can graffiti (write data) inside the bounds.

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.