LVM (Logical Volume Manager) is a tool in Linux which can help you manage disk drives and partition. Usually it being used in server/computer whereby you can easily re-size the partition, creating snapshots backup, combined all hard disk to be run under one partition and many more.
In this case, I already have logical volume “/dev/mapper/VolGroup00-LogVol00” mounted as “/” partition in the server but the disk space is too small which is 50GB. I want to expand it to 170GB with another 120GB hard disk combine together. The new hard disk already plugged in the server and detected by the system. So we are going to do this online without downtime. Variables as below:
OS: CentOS 5.6 64bit
LV name: /dev/mapper/VolGroup00-LogVol00
New HD: /dev/sdb (120GB)
1. Make sure that you have logical volume mapped to your “/” partition. If you are using default CentOS partitioning during installation, you should see something like below:
[[email protected] ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/VolGroup00-LogVol00 47G 3.2G 43.8G 8% / /dev/sda1 99M 13M 81M 14% /boot tmpfs 249M 0 249M 0% /dev/shm |
2. Check whether new hard disk has been detected on the system or not. It should be /dev/sdb:
[[email protected] ~]# fdisk -l Disk /dev/sda: 53.6 GB, 53687091200 bytes 255 heads, 63 sectors/track, 6527 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sda1 * 1 13 104391 83 Linux /dev/sda2 14 6527 52323705 8e Linux LVM Disk /dev/sdb: 128.8 GB, 128849018880 bytes 255 heads, 63 sectors/track, 15665 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk /dev/sdb doesn't contain a valid partition table |
3. This new hard disk does not have partition table yet. So we need to create one using fdisk:
[[email protected] ~]# fdisk /dev/sdb ...... Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-15665, default 1): Using default value 1 Last cylinder or +size or +sizeM or +sizeK (1-15665, default 15665): Using default value 15665 Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. |
The sequence I press on the keyboard is: n > p > 1 > Enter > Enter > w > Enter
Continue reading “Increasing Disk Space in CentOS using LVM” »