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 5 of 7

Extending Volume Group:

Now I want to create one more Logical volume for storing my videos about the size 20 GB. See in the above I don’t have that much free space in volume group (smbserver).

Now my volume group (smbserver) contains only free space about 5GB. To get more space i need to extend my volume group (smbserver). As you see when I was created the volume group (smbserver), I left the one hdd ie PV. I am going to use that hdd to extend the VG (smbserver).

Alloc PE / Size 14080 / 55.00 GB

Free PE / Size 1274 / 4.98 GB

The following PV(/dev/sdf1)which i left before. Use the following command to extend the VG (smbserver).

[root@SRV01 ~]# vgextend smbserver /dev/sdf1

Volume group “smbserver” successfully extended

See down I have more enough space to create one more LV (videos).

[root@SRV01 ~]# vgdisplay smbserver

— Volume group —

VG Name smbserver

System ID

Format lvm2

Metadata Areas 4

Metadata Sequence No 6

VG Access read/write

VG Status resizable

MAX LV 0

Cur LV 2

Open LV 2

Max PV 0

Cur PV 4

Act PV 4

VG Size 79.97 GB

PE Size 4.00 MB

Total PE 20472

Alloc PE / Size 14080 / 55.00 GB

Free PE / Size 6392 / 24.97 GB

VG UUID qU2OUf-gqKB-B1fd-VBjt-6W7H-tE4z-nt782r

Let’s create the LV (videos) with size of 20GB in VG (smbserver).

[root@SRV01 ~]# lvcreate -L 20G -n videos smbserver

Logical volume “videos” created

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 4

Metadata Sequence No 7

VG Access read/write

VG Status resizable

MAX LV 0

Cur LV 3

Open LV 2

Max PV 0

Cur PV 4

Act PV 4

VG Size 79.97 GB

PE Size 4.00 MB

Total PE 20472

Alloc PE / Size 19200 / 75.00 GB

Free PE / Size 1272 / 4.97 GB

VG UUID qU2OUf-gqKB-B1fd-VBjt-6W7H-tE4z-nt782r

Mount the LV using the steps given above.

[root@SRV01 ~]# mount

/dev/sda3 on / type ext3 (rw)

proc on /proc type proc (rw)

sysfs on /sys type sysfs (rw)

devpts on /dev/pts type devpts (rw,gid=5,mode=620)

/dev/sda8 on /tmp type ext3 (rw)

/dev/sdb5 on /opt type ext3 (rw)

/dev/sda7 on /home type ext3 (rw)

/dev/sda6 on /var type ext3 (rw)

/dev/sda5 on /usr type ext3 (rw)

/dev/sda1 on /boot type ext3 (rw)

tmpfs on /dev/shm type tmpfs (rw)

/dev/sdb6 on /vm type ext3 (rw)

none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)

sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)

none on /var/lib/xenstored type tmpfs (rw)

/dev/hdc on /media/CentOS_5.3_Final type iso9660 (ro,noexec,nosuid,nodev,uid=0)

/dev/mapper/smbserver-data on /smbserver/data type ext3 (rw)

/dev/mapper/smbserver-backup on /smbserver/backup type ext3 (rw)

/dev/mapper/smbserver-videos on /smbserver/videos type ext3 (rw)

Page 4: Setup Logical Volume Group

Page 6: Extending Logical Volume

You might also like