Friday, December 21, 2012

How to Extend LV (RHEL 5,8)

Hi All,


How to Extend LV where online extension is not allowed. this was a case

1. first we have to check what message comes when online extension or reduction is not allowed.
2. If this message comes, we have to inform Application Team or User that they have to stop using that server for some duration.
3. Only on availability of Downtime, we can go ahead with Extension or reduction.
4. below are the commands.
5. Here just wanted to raise the value of LV /home_new to 51 GB from 49 GB.
6. first, we need to calculate the value of free PE or available PE with us with help of vgdisplay command we can do.
7. We have to calculator "bc -l" and add the 49*1024+2*1024
8. it will give the result.
9 lvextend -L (49*1024+2*1024)mb /dev/mapper/vg00-home_new
10. after this we have to use e2fsck or resize2fs command to make that size available. as lvextend command will run successfully.
11. in this case online extension with resize2fs was not happening or allowed. so had to use below pattern.


[root /]#
[root /]#
[root /]# date
Thu Dec 20 17:43:20 IST 2012
[root /]#
[root /]# umount /home_new
[root /]#
[root /]# resize2fs /dev/mapper/vg00-home_new
resize2fs 1.39 (29-May-2006)
Please run 'e2fsck -f /dev/mapper/vg00-home_new' first.
[root /]# e2fsck -f /dev/mapper/vg00-home_new
e2fsck 1.39 (29-May-2006)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/mapper/vg00-home_new: 4851/6553600 files (0.1% non-contiguous), 3403493/13107200 locks
[root /]#
[root /]#
[root /]# resize2fs /dev/mapper/vg00-home_new
resize2fs 1.39 (29-May-2006)
Resizing the filesystem on /dev/mapper/vg00-home_new to 13500416 (4k) blocks.
The filesystem on /dev/mapper/vg00-home_new is now 13500416 blocks long.
[root /]#
[root /]#
[root /]# mount /dev/mapper/vg00-home_new /home_new/
[root /]#
[root /]# df -hT
Filesystem    Type    Size  Used Avail Use% Mounted on
/dev/sda2     ext3     39G   23G   15G  61% /
/dev/sda1     ext3     99M   12M   83M  13% /boot
tmpfs        tmpfs    8.0G     0  8.0G   0% /dev/shm
dev/mapper/vg00-home_new
              ext2     51G   13G   36G  26% /home_new
[root /]#
[root /]#
[root /]#
[root /]#


I may have given in wrong wa or right, please comment or suggest on this and improve my skill. your comments are appreciated.

 

No comments: