In this example,expanding the nagios machine (lvm size)
Use the following steps to expand VM size ( lvm expand)
1) #xm list (showning running VM)
[root@inf1basevm01 ~]# xm list
Name ID Mem(MiB) VCPUs State Time(s)
Domain-0 0 7269 4 r----- 4505.4
ind1basevm01 1 255 1 -b---- 17.3
ind1infra01 2 255 1 -b---- 17.4
nagios 4 256 1 -b---- 0.3
Showing 3 running virtual machines.
2)shut down the running VM (through login or use following command)
#xm shutdown nagios
3) use fdisk to check...
[root@inf1basevm01 ~]# fdisk -l /dev/VmImage/nagios
Disk /dev/VmImage/nagios: 16.1 GB, 16106127360 bytes
255 heads, 63 sectors/track, 1958 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/VmImage/nagios1 * 1 13 104391 83 Linux
/dev/VmImage/nagios2 14 1958 15623212+ 8e Linux LVM
***now Disk size is 16.1GB***
4) Now expand the LVM size.
[root@inf1basevm01 ~]# lvextend /dev/VmImage/nagios -L +2GB
Extending logical volume nagios to 17.00 GB
Logical volume nagios successfully resized
5) Now check again with fdisk.
[root@inf1basevm01 ~]# fdisk -l /dev/VmImage/nagios
Disk /dev/VmImage/nagios: 18.2 GB, 18253611008 bytes
255 heads, 63 sectors/track, 2219 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
*** you able to see 18.2GB (mean 2GB expand)***
6) Now start the VM
#xm create nagios
Using config file "/etc/xen/nagios".
Started domain nagios
7) # xm list
[root@inf1basevm01 ~]# xm list
Name ID Mem(MiB) VCPUs State Time(s)
Domain-0 0 7269 4 r----- 4505.4
ind1basevm01 1 255 1 -b---- 17.3
ind1infra01 2 255 1 -b---- 17.4
nagios 4 256 1 -b---- 0.3
Its show all 3 VM are up now.
---------------------------------------------------------------------------------
Now very important part....
Login as root on nagios machine (VM machine)
Run #fdisk -l and #df -h ( you got the difference)
Now run
#fdisk /dev/xvda (create partition)
according to yours.
use partprobe command or reboot the machine to make online disk.
#partprobe
After that run pvdisplay ( to check current physical volume)
#pvdisplay
Now create physical volume on /path/of/drive like following
# [root@nagios ~]# pvcreate /dev/xvda3
Physical volume "/dev/xvda3" successfully created
[root@nagios ~]# vgdisplay
Now run vg display for check volume group
#vgdisplay
Now extend you VG
#[root@nagios ~]# vgextend VolGroup00 /dev/xvda3
Volume group "VolGroup00" successfully extended
**VolGroup00 is VG name**
#vgdisplay
Now extend you LVM
#lvdisplay
#[root@nagios ~]# lvextend /dev/VolGroup00/root -L +3.90GB
Rounding up size to full physical extent 3.91 GB
Extending logical volume root to 17.78 GB
Logical volume root successfully resized
Now run following command very carefully
#[root@nagios ~]# resize2fs /dev/VolGroup00/root 17G
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/VolGroup00/root is mounted on /; on-line resizing required
Performing an on-line resize of /dev/VolGroup00/root to 4456448 (4k) blocks.
The filesystem on /dev/VolGroup00/root is now 4456448 blocks long.
***The resize2fs program will resize ext2 or ext3 file systems. It can be used to enlarge or shrink an unmounted file system located on device. If the filesystem is mounted, it can be used to expand the size of the mounted filesystem, assuming the kernel supports on-line resizing. (As of this writing, the Linux 2.6 kernel supports on-line resize for filesystems mounted using ext3 only.)*****
Now Run following command to check space.
[root@nagios ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup00-root
18G 1.1G 16G 7% /
/dev/xvda1 99M 21M 74M 22% /boot
tmpfs 129M 0 129M 0% /dev/shm
That's End of the story.........Hope this work for you.... Enjoy and have a nice day.
Wednesday, December 30, 2009
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment