Logical Volume Manager (LVM)

Herewith my little post about lvm. It is very long time ago, and it is not easily to remembered. So i’ll try to keep it safe πŸ˜‰

First, i’ll try to describe a little concept about lvm like these:
1. Physical Volume, It’s like you have a plot of land (sebuah kaveling tanah), /dev/sda is an example if you’re using SCSI or /dev/hda for IDE. So if we have two sda drive, we have two PV.
2. Volume Group,
It’s consist of many ‘house‘ or physical volume that can be increase or decrease.
3. Logical Volume,
It’s called by ‘house‘ that you have build on physical volume.

I choose my centos 6 with all partitions here: UICreateBeginI have been always remembered myself to create /boot as a primary, / as a logical, swap is twice of your ram, then do not use ext4 format if your distro not applicable with it.

1. Merge two partitions
In this case, i’m using six partitions: step1then, we make a physical volume for both partitions. step2Scan or reading all physical volume for LVM configuration, then we create Volume Group with names ‘data’ for both partitions. step3Let we check that Volume Group was properly configure. step4Then we create and we check the Logical Volume with total allocation for ‘Total PE’. It will be produced an output in path /dev/data/lvdata step5Now we format them with ext4 format. step6Finished, it can be used by mounting into specific folder. step7

2. Extends the partition
So, now we will be able to extend the /data with another partition into physical volume from volume group by using /data3 also known as /dev/sda9. We unmount, create physical volume then check it.
[root@centos ~]# umount /dev/sda9
[root@centos ~]# pvcreate /dev/sda9 step9After all, we must register that PV into VG with names ‘data’ with these params. step10As we can see, VG size has been increased by total from 1.95Β  to 2.92 GiB so we have to increased LV capacity by unmount that first, re-mount it, than extend with proper ‘Total PE’ that you want. step11But, as we can see.. size didn’t increased yet. So we have to resize that partition (/dev/data/lvdata). step12step13Voila !!, we use all of capacity of our disks. Honestly, we can use optional number allocation at params resize2fs /dev/data/lvdata <how_much_size>

[root@centos ~]# resize2fs /dev/data/lvdata 300M

3. Shortens the Partitions
In this case, we try to shorten our /data. Unmount that parts, scan file system by e2fsck, resize it (with specific amount), and re-mount. step14step15

PS : Sometimes, we have a trouble since the UUID or BlockID on our devices has been changed during the LVM activity. It makes our system CRASHED!! 😦 . So what do we do ??. Read here.
1. Login into safe mode on your system.
2. Just type ‘blkid’ (without quote).
3. Check and see the conditions /etc/fstab with ls params or cat
4. Mount and remount slash root /
5. Change permission for /etc/fstab
6. Then edit (In future, you can mount it manually by registered the mount params in /etc/rc.local) solved Thanks



2 responses to “Logical Volume Manager (LVM)

  1. Pingback: Extends Storage – Performing an online resize | TifosiLinux

  2. Pingback: Extends Storage – Performing an online resize | TifosiLinux

Tinggalkan pesan atau komentar

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s