網頁

2013年5月11日 星期六

CentOS 6.3 --- Add a New Disk into the existing Volume Group by LVM Command Line Interface

For increasing (or reducing) the size of the file system, we can use its flexible advantage to mange disk resource if the system deploys LVM.
At first, we have to realize whether can use all available space on the Logical Volume.
               If have, we can directly grow the file system from the free space of Volume Group.
               If no, we have to expand the Volume Group by adding the additional disk.

In the following lab, it will show you how to grow file system after add new disk because its operation also includes directly expand the space on LV.

Prerequisite
To check the size of the file system to realize whether the space then needs to be extend by using df –h commandScreenHunter_02                  In the moment, the available space is 41MB and all space use 96% on the filesystem /dev/mapper/drbdVG00-drbdLV0

By using lvdisplay /dev/mapper/drbdVG00-drbdLV0 command, we can find out which Volume Group Name drbdVG00 contain this Logical Volume.ScreenHunter_03
By using vgdisplay drbdVG00 command, we can find out whether the volume group drbdVG00 has available free space to allocate to the logical volume.ScreenHunter_04           In the moment, there is no free physical extents so that need to add new disk as adding physical volume to this volume group.

After add new disk online (# 1), we need to confirm whether the system can probe this new disk by using ls /dev/sd* commandScreenHunter_10or realize what is the status of the partition of the disk by using df –h commandScreenHunter_11ScreenHunter_12
Create Physical Volume

Due to the new disk never is partitioned, we will create the whole disk as a physical volume so that will convert this disk into a physical volume by using pvcreate /dev/sdc command.ScreenHunter_13By using pvscan or pvscan –n command, we can know whether the physical volume is created successfully and are sure this new physical volume never belongs to any volume group now.ScreenHunter_14
Add Physical Volume into the existing Volume GroupAfter the physical volume is created, we need to add it to the existing volume group by using vgextend drbdVG00 /dev/sdc command.ScreenHunter_15In volume group, there is free physical content that is ready to be allocated to logical volume now by using vgdisplay drbdVG00 command.ScreenHunter_16Extend Logical Volume SizeBy using lvextend –L +1020M /dev/drbdVG00/drbdLV0 command, we will extend the size of Logical Volume about 1020 MB.ScreenHunter_17             The “AS-IS” of using lvextend commandScreenHunter_18             The “TO-BE” of using lvextend commandScreenHunter_19
Resize Filesystem
By using resize2fs /dev/drbdVG00/drbdLV0 command, we can resize filesystem so that logical volume will have additional space to be used now.ScreenHunter_20Until now, we can use the additional space that provided by the new disk if the above process completes successfully.

Reference :
(# 1)
In Hyper-V 3.0 manager, we can add the SCSI virtual disk onlineScreenHunter_07
       and choose a location value to avoid the conflict with the existing disk.ScreenHunter_08

沒有留言:

張貼留言

Since 2010 Design by Davidwa
©Copyright Davidwa Inc. All rights reserved.