Showing posts from February, 2016

CentOS - LVM quick notes

Please refer to full documentation online - LVM Administrator's Guide

Am not responsible if you break your server by following my notes.

TIP: If not sure, always try on TEST server before running your commands on PRODUCTION.

SCENARIO: There is a Fresh install of CentOS on VM (TEST Server)

[root@localhost ~]# df -h
Filesystem                    Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root  6.7G  1.1G  5.3G  17% /
tmpfs                         250M  4.0K  250M   1% /dev/shm
/dev/sda1                     485M   31M  430M   7% /boot

By default LVM is used.

REQUIREMENT: Add new logical volume to the server (use existing Volume Group called "VolGroup").

1. add new Virtual Hard Disk (at VMWARE or VIRTUALBOX level)
2. fdisk -l ( e.g newly added disk is /dev/sdb)
3. pvcreate /dev/sdb
4. pvs (verify)
5. vgextend VolGroup /dev/sdb
6. vgs (verify)
7. lvcreate -L 450M -n mydata VolGroup  (create new logical volume of 450MB named "mydata")
8. lvs (verify,…