Open main menu

CDOT Wiki β

Changes

OPS245 Lab 2 dev

22 bytes removed, 23:33, 29 January 2023
Part 1: Backing Up Virtual Machines
<ol><li value="7"> Compare the size of the compressed and original files (hint: use '''ls -lh'''). If file is very large (like 15GB), you didn't compress it and you need to remove that file and perform the previous step until you get it right!</li>
<li>Once you are '''sure you have all three VMs backed up''', use the <b><code><span style="color:#3366CC;font-size:1.2em;">exit</span></code></b> command to revert back to your normal user.</li>
<li> Start the '''''centos3rhel3''''' 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 rhel3 system! Try this command inside the centos3 rhel3 virtual machine:<b><code><span style="color:#3366CC;font-size:1.2em;">sudo rm -rf /*</span></code></b> (ignore error messages).</li><li> Shut down and restart the centos3 rhel3 VM (you may need to use the '''Force Reset''' option to do so).</lI>
<li> When the machine restarts it will not boot since all system files have been removed!</li>
<li> Use the '''Force Off''' option to turn centos3 rhel3 back off.</li><li> Restore the original image from the backup from your home directory to your '''images''' directory by typing <b><code><span style="color:#3366CC;font-size:1.2em;">sudo -i</span></code></b> command first [do not forget to '''exit''' when you are done], then this command:<br><b><code><span style="color:#3366CC;font-size:1.2em;">gunzip < ~YourRegularUsername/backups/centos3rhel3.qcow2.gz > /var/lib/libvirt/images/centos3rhel3.qcow2'''</span></code></b></li>
<li> Restart the VM. Is it working normally?</li>
<li> You should also make a copy of the XML configuration file for each VM 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 rhel3 XML configuration file, and prove that a "clone" can be added to your list.Please perform the following step:</li><li> Execute the following command: <b><code><span style="color:#3366CC;font-size:1.2em;">sudo virsh dumpxml centos3 rhel3 > centos3rhel3.xml</span></code></b></li><li> Examine the file <b><code><span style="color:#3366CC;font-size:1.2em;">centos3rhel3.xml</span></code></b>. What does it contain? What format is it in?<br></li></ol>
=== Part 2: Restoring Virtual Machines ===