Changes

Jump to: navigation, search

OPS235 Lab 2 - CentOS7

417 bytes removed, 07:41, 2 April 2015
no edit summary
== Part 2: Backing Up Virtual Machines ==
{{Admon/important|Backing up VMs|There are two general processes in order to back up your images:<ol><li>'''Compressing your images''' (also recommended to backup up to external storage USB Key) using the '''gzip''' command.</li><li>'''Backup the VM xml configuration file''' (preferably to USB key) using '''virsh''' shell command to add VM to virtual machine manager list (in the event that the HOST machine is "wiped" and re-installed, but VM images and xml configuration files have been backed up external storage).</li></ol><br />Taking the time to backup the image of the Operating System's file system allows the user to return to a '''"restoration point"''' using the '''gunzip''' command in case something bad occurs to the OS during a lab.<br />Failure to take the time to make and confirm backups can result in loss of lab work for the student!|}}
{| width="40%" align="right" cellpadding="10"
|- valign="top"
|colspan="2"|{{Admon/important|Backing up VMs|There are two general processes in order to back up your images:<ol><li>'''Compressing your images''' (also recommended to backup up to external storage USB Key) using the '''gzip''' command.</li><li>'''Backup the VM xml configuration file''' (preferably to USB key) using '''virsh''' shell command to add VM to virtual machine manager list (in the event that the HOST machine is "wiped" and re-installed, but VM images and xml configuration files have been backed up external storage).</li></ol><br />Taking the time to backup the image of the Operating System's file system allows the user to return to a '''"restoration point"''' using the '''gunzip''' command in case something bad occurs to the OS during a lab.<br />Failure to take the time to make and confirm backups can result in loss of lab work for the student!|}}
|}
# Shut down all of the virtual machines.
# Change to the directory <code>/var/lib/libvirt/images/</code>. Note the size of the files in this directory. What do these files contain?
# Make a compressed backup of the <code>centos3.img</code> file to your home directory with this command: <b><code><span style="color:#3366CC;font-size:1.2em;">gzip < centos3.img > ~YourUserId/centos3.img.backup.gz</span></code></b><br />(Note: Make certain to use the redirection signs "<" and ">" properly in the command!)
{{Admon/caution| Make sure the backup is successful!|If there are any error messages, '''DO NOT''' proceed past this point. You're going to destroy your centos3 virtual machine and restore it using the backup you have created -- if there are any problems with the backup, you will not have a working virtual machine, and will have to re-install it.}}<ol> <li value="4"># Compare the size of the compressed and original files.</li> <li># Start the '''''centos3''''' VM.</li> <li># '''Make certain that you are in your VM and <u>not</u> in your main system!'''</li> <li# >Wreck <u>only</u> your centos3 system! Try this command inside the centos3 virtual machine:<b><code><span style="color:#3366CC;font-size:1.2em;">rm -rf /*</span></code></b></li> <li># Shut down the VM. If you tried to start the centos3 VM, it would not boot since all system files have been removed!</li> <li># Restore the original image from the backup in your home directory by typing this command: <b><code><span style="color:#3366CC;font-size:1.2em;">gunzip < ~YourUserId/centos3.img.backup.gz > centos3.img'''</span></code></b></li> <li># Restart the VM. Is it working normally?</li> <li># Create compressed backups of your other virtual machines.</li></ol><ol><li value="12"># You should make a copy of the xml configuration file in case you "wipe" and re-install the host machine, and want to add a restored VM backups to the virtual machine manager list. We will demonstrate using the centos3 xml configuration file, and prove that a "clone" can be added to your list.Please perform the following step:<ol type="a"> <li># Execute the following command: <b><code><span style="color:#3366CC;font-size:1.2em;">virsh dumpxml centos3 >centos3.xml</span></code></b></li> <li># Examine the file <b><code><span style="color:#3366CC;font-size:1.2em;">centos3.xml</span></code></b>. What does it contain? What format is it in?</li> <li># Make a copy of <b><code><span style="color:#3366CC;font-size:1.2em;">centos3.xml</span></code></b> called <code>centos3a.xml</code>.</li> <li># Edit the file <b><code><span style="color:#3366CC;font-size:1.2em;">centos3a.xml</span></code></b>, making the following changes:</li></ol>
::* Change the name (in the file, not the file name) to '''centos3a'''
::* Change at least one of the hexadecimal characters in the UUID. Do not change the length of the UUID. Valid hexadecimal characters are 0-9 and a-f.
13,420
edits

Navigation menu