How To Configure LVM on Linux / CentOS / Redhat

0

Page index:
Overview
Setup Physical Volumes
Setup Volume Groups
Setup Logical Volume Group
Extending Volume Group
Extending Logical Volume
Reducing Logical Volume

Page 3 of 7
Let’s create it again.

[root@SRV01 ~]# pvcreate /dev/sdc1 /dev/sdd1 /dev/sde1

Physical volume “/dev/sdc1” successfully created

Physical volume “/dev/sdd1” successfully created

Physical volume “/dev/sde1” successfully created

Physical volume “/dev/sdf1” successfully created

List the physical volume details.

[root@SRV01 ~]# pvscan

PV /dev/sdc1 lvm2 [19.99 GB]

PV /dev/sdd1 lvm2 [19.99 GB]

PV /dev/sde1 lvm2 [19.99 GB]

PV /dev/sdf1 lvm2 [19.99 GB]

Total: 4 [79.97 GB] / in use: 0 [0 ] / in no VG: 4 [79.97 GB]

Display the details about PV.

[root@SRV01 ~]# pvdisplay

“/dev/sdc1” is a new physical volume of “19.99 GB”

— NEW Physical volume —

PV Name /dev/sdc1

VG Name

PV Size 19.99 GB

Allocatable NO

PE Size (KByte) 0

Total PE 0

Free PE 0

Allocated PE 0

PV UUID LJG8dL-hgFi-Tnjp-Ry6I-euNH-mBce-gTb0wj

“/dev/sdd1” is a new physical volume of “19.99 GB”

— NEW Physical volume —

PV Name /dev/sdd1

VG Name

PV Size 19.99 GB

Allocatable NO

PE Size (KByte) 0

Total PE 0

Free PE 0

Allocated PE 0

PV UUID N01AmP-2y7J-FUIF-iPdn-w1SF-8JDp-KJMSy7

“/dev/sde1” is a new physical volume of “19.99 GB”

— NEW Physical volume —

PV Name /dev/sde1

VG Name

PV Size 19.99 GB

Allocatable NO

PE Size (KByte) 0

Total PE 0

Free PE 0

Allocated PE 0

PV UUID zmmtGR-xrvQ-MzIl-1Auv-7Z6f-yXhU-NuZpu0

“/dev/sdf1” is a new physical volume of “19.99 GB”

— NEW Physical volume —

PV Name /dev/sdf1

VG Name

PV Size 19.99 GB

Allocatable NO

PE Size (KByte) 0

Total PE 0

Free PE 0

Allocated PE 0

PV UUID 2did5n-qNYl-157V-byLn-1A69-1aXT-gP0W93

Volume Group Creation:

Now we can create the volume group named “smbserver”. Here we will use only three PV’s. The fourth one we will use when extending the VG.

[root@SRV01 ~]# vgcreate smbserver /dev/sdc1 /dev/sdd1 /dev/sde1

Volume group “smbserver” successfully created

Remove the VG for testing purpose.

[root@SRV01 ~]# vgremove smbserver

Volume group “smbserver” successfully removed

Create it again.

[root@SRV01 ~]# vgcreate smbserver /dev/sdc1 /dev/sdd1 /dev/sde1

Volume group “smbserver” successfully created

Use the following command to list how many volume group are available on server.

[root@SRV01 ~]# vgscan

Reading all physical volumes. This may take a while…

Found volume group “smbserver” using metadata type lvm2

The following command shows the brief details about the volume group called “smbseerver”. You can use the command without second argument (smbserver) that will brief all VG’s in server.

[root@SRV01 ~]# vgdisplay smbserver

— Volume group —

VG Name smbserver

System ID

Format lvm2

Metadata Areas 3

Metadata Sequence No 1

VG Access read/write

VG Status resizable

MAX LV 0

Cur LV 0

Open LV 0

Max PV 0

Cur PV 3

Act PV 3

VG Size 59.98 GB

PE Size 4.00 MB

Total PE 15354

Alloc PE / Size 0 / 0

Free PE / Size 15354 / 59.98 GB

VG UUID v5pnWs-mrqq-XTYa-hePj-RqS8-cJv8-Z59fdC

Page 2: Setup Physical Volumes

Page 4: Setup Logical Volume Group

You might also like