For saving hard disk space in virtualization lab, we will generally create a virtual hard disk with parent-child relationship. Thanks every virtualization vendors to supply the related tool in its product. In the moment, I will introduce you “How to do it when there is existing CentOS 6.3 VM in Hyper-V 3.0?”
Define the folder to store VM files
For clearly making a distinction about VM stored location, we can design the different folder or the different physical disk to store these files for management and maintenance. So do that we don’t worry happen disk space or performance issue in the future.When we have already desired the VM location by Explorer, the next step will be change VM stored path in Hyper-V setting.
Create a new VM without virtual hard disk
In Hyper-V Manager, right-click the Hyper-V Server next to select New and Virtual Machine… in menu to launch New Virtual Machine Wizard.In Before You Begin dialog, click Next > buttonIn Specify Name and Location dialog, write down a VM name as “HV-CENTOS-01”, enable Store the virtual machine in a different location check box and then click Next > buttonIn Assign Memory dialog, define Startup memory as “512 MB”, enable Use Dynamic Memory for this virtual machine check box and then click Next > buttonIn Configure Networking dialog, choose one network adapter next to click Next > buttonIn Connect Virtual Hard Disk dialog, choose Attach a virtual hard disk later option next to click Next > buttonClick Finish button to complete the New Virtual Machine WizardAnd its related files will be created on the defined path as well.
Create a child virtual hard disk with parent-child relationship
In this new VM, create a new folder as “Virtual Hard Disks” for locating the child virtual hard disk later.Before creating the new child virtual hard disk, please remember firstly to power off the parent VM (# 1) next to right-click the Hyper-V Server and select New, Hard Disk… in menu to launch New Virtual Hard Disk Wizard.In Before You Begin dialog, click Next > buttonIn Choose Disk Format dialog, choose VHDX option next to click Next > buttonIn Choose Disk Type dialog, choose Differencing option next to click Next > buttonIn Specify Name and Location dialog, assign a name as ‘HV-CENTOS-01_50GB.vhdx”, click Browse… button to select the child virtual hard disk path and then click Next > buttonIn Configure Disk dialog, click Browse… button to select the Parent virtual hard disk next to click Next > buttonClick Finish button to complete the New Virtual Hard Disk WizardSo does that the child virtual hard disk will be created now.
Add Child virtual hard disk to the new VM
If you remember that the new VM in the wizard process is never created any new virtual hard disk, it is time to add it for the new VM.
In Hyper-V Manager, select the new VM as “HV-CENTOS-01” and then click Settings… linkIn the Hardware setting of this VM, select IDE Controller 0 in the left panel, Hard Drive and then click Add buttonIn Hard Drive tab, select Hard Drive <file> in left panel, choose Virtual hard disk option, click Browse… button to select the child virtual hard disk file.Click OK button if the above selection is right.Until now, this New VM has already finish the related configuration and it is working normally when boot it.No!
Although the CentOS VM can be booted, its network function has some problem due to MAC address is changed.
How to resolve this problem?
I will explain it In the next article.
Reference :(# 1) If the Parent VM doesn’t be powered off and launch New Virtual Hard Disk Wizard, the procedure will fail due to the parent file is being used by another process.
不必問我是誰,我就像您一樣:僅是位平凡人,但卻想在人生旅途上留下生活的足跡! 哪怕是過程跌跌撞撞、經歷風風雨雨,只要有您的關注,就是我最大的欣慰與成就!!! 感謝您的蒞臨:) 下一個職涯十年信念:不到最後關頭,決不輕言放棄!!!
2013年4月6日 星期六
CentOS 6.3 --- Building and installing DRBD from source (part 2)
Although we can simply install DRBD by using yum, maybe it is another choice to compile DRBD and kernel modules from source due to want to suit the kernel.
Update kernel
Display the current kernel release and hardware platform by using “uname –r”by using “yum install kernel-devel” (# 1)
Update the kernel modules by “yum update kernel kernel-devel” next to reboot again.Now the kernel version is from “2.6.32-279.el6.x86_64” to “2.6.32-358.2.1.el6.x86_64”
Download and extract DRBD source
Due to wget command doesn’t exist in minimal installation, we have to install this utility by using “yum install wget”The console switch to /usr/src and begin to download DRBD source tarballs from LINBIT Open Source Software – drbd by using "wget http://oss.linbit.com/drbd/8.4/drbd-8.4.2.tar.gz "To uncompress DRBD into a directory /usr/src for keeping source code by using “tar zxvf drbd-8.4.2.tar.gz”
Check build prerequisiteInstall this utility for working C compiler by using “yum install gcc” (# 2)Install this utility for scanner(text pattern recongnizer) generator by using “yum install flex” (# 3) Install this utility for building RPM (or rebuilding SPRM) package by using “yum install rpm-build” (# 4)Install this utility by using “yum install git” (# 5)Install this utility by using “yum install libxml2*” and “yum install libxslt*” (# 6)
Install this utility by using “yum install make” (# 7)
Build RPM package
Switch to the source directory by using “cd drbd-8.4.2”To create the RPM building environment by running the command “mkdir -pv ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}”To generate make files by using “./configure”by using “make rpm”by using “make km-rpm”
Install DRBD
Switch to a RPMS directory by using “cd ~/rpmbuild/RPMS/x86_64” and install drbd package by using “rpm –Uvh drbd-utils-….rpm drbd-km-….rpm”Load drbd module by using “modprob drbd” and verify whether drbd module is loaded by using "lsmod | grep drbd"
Reference :
(# 1) If no update kernel, RPM build will error when execute the command “make km-rpm”(# 2) If the system never install gcc package, we will get the following error when execute the command “./configure”(# 3) If the system never exist flex package, the checking process will fail when execute the command “./configure”(# 4) If the system never exist rpm-build package, the checking process will fail when execute the command “./configure”(# 5) If the system never exist git package, the checking process will fail when execute the command “./configure”(# 6) If the system never exist libxml2 and libxslt package, the checking process will fail when execute the command “./configure”(# 7) If the system never exist make package, the checking process will fail when execute the command “./configure”
<<< CentOS 6.3 --- Installing pre-built DRBD packages from distribution vendors (part 1)
Update kernel
Display the current kernel release and hardware platform by using “uname –r”by using “yum install kernel-devel” (# 1)
Update the kernel modules by “yum update kernel kernel-devel” next to reboot again.Now the kernel version is from “2.6.32-279.el6.x86_64” to “2.6.32-358.2.1.el6.x86_64”
Download and extract DRBD source
Due to wget command doesn’t exist in minimal installation, we have to install this utility by using “yum install wget”The console switch to /usr/src and begin to download DRBD source tarballs from LINBIT Open Source Software – drbd by using "wget http://oss.linbit.com/drbd/8.4/drbd-8.4.2.tar.gz "To uncompress DRBD into a directory /usr/src for keeping source code by using “tar zxvf drbd-8.4.2.tar.gz”
Check build prerequisiteInstall this utility for working C compiler by using “yum install gcc” (# 2)Install this utility for scanner(text pattern recongnizer) generator by using “yum install flex” (# 3) Install this utility for building RPM (or rebuilding SPRM) package by using “yum install rpm-build” (# 4)Install this utility by using “yum install git” (# 5)Install this utility by using “yum install libxml2*” and “yum install libxslt*” (# 6)
Install this utility by using “yum install make” (# 7)
Build RPM package
Switch to the source directory by using “cd drbd-8.4.2”To create the RPM building environment by running the command “mkdir -pv ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}”To generate make files by using “./configure”by using “make rpm”by using “make km-rpm”
Install DRBD
Switch to a RPMS directory by using “cd ~/rpmbuild/RPMS/x86_64” and install drbd package by using “rpm –Uvh drbd-utils-….rpm drbd-km-….rpm”Load drbd module by using “modprob drbd” and verify whether drbd module is loaded by using "lsmod | grep drbd"
Reference :
(# 1) If no update kernel, RPM build will error when execute the command “make km-rpm”(# 2) If the system never install gcc package, we will get the following error when execute the command “./configure”(# 3) If the system never exist flex package, the checking process will fail when execute the command “./configure”(# 4) If the system never exist rpm-build package, the checking process will fail when execute the command “./configure”(# 5) If the system never exist git package, the checking process will fail when execute the command “./configure”(# 6) If the system never exist libxml2 and libxslt package, the checking process will fail when execute the command “./configure”(# 7) If the system never exist make package, the checking process will fail when execute the command “./configure”
<<< CentOS 6.3 --- Installing pre-built DRBD packages from distribution vendors (part 1)
訂閱:
文章 (Atom)
Since 2010 Design by Davidwa
©Copyright Davidwa Inc. All rights reserved.
©Copyright Davidwa Inc. All rights reserved.