Changes

Jump to: navigation, search

OPS235 Lab 2

93 bytes added, 17:32, 25 January 2019
INVESTIGATION 3: MANAGING VIRTUAL MACHINES (KVM)
# In your '''c7host''' VM, open a new Terminal window, and '''switch to the root account ''inside'' the terminal'''.
# Change to the images directory by issuing the command: <b><code><span style="color:#3366CC;font-size:1.2em;">cd /var/lib/libvirt/images/</span></code></b><ul><li>Note the size of the files in this directory. What do these files contain?</li></ul>
# Make a compressed backup of your '''centos1.qcow2''', '''centos2.qcow2''', and '''centos3.qcow2''' files to your regular user's home directory by issuing each command (one at a time):<br><b><code><span style="color:#3366CC;font-size:1.2em;">gzip < centos1.qcow2 > ~YourRegularUsername/centos1.qcow2.backup.gz</span></code></b><br><b><code><span style="color:#3366CC;font-size:1.2em;">gzip < centos2.qcow2 > ~YourRegularUsername/centos2.qcow2.backup.gz</span></code></b><br><b><code><span style="color:#3366CC;font-size:1.2em;">gzip < centos3.qcow2 > ~YourRegularUsername/centos3.qcow2.backup.gz</span></code></b><brul>'''NOTE:''' Make certain to use the redirection signs "<br" and ">" properly in the command!</ul>
{{Admon/important |Please be patient|It may look like the command prompt is stuck but it could take a while for gzip to compress an entire operating system. '''NOTE:''' Do NOT press '''&lt;ctrl&gt;c''' to cancel this process. If you do, your archive will become incomplete and your recovery will be corrupt.}}
('''NOTE:''' Make certain to use the redirection signs "<ol><li value=" and 5">" properly in the command!)<br><br># 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> 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> (ignore error messages).</li># <li> Shut down the centos3 VM. If you tried to start the centos3 VM, it would not boot since all system files have been removed!</li># <li> Make certain you are in your '''/var/lib/libvirt/images directory'''. Restore the original image from the backup from your home directory to your '''images''' directory by typing this command:<br><b><code><span style="color:#3366CC;font-size:1.2em;">gunzip < ~YourUserId/centos3.qcow2.backup.gz > centos3.qcow2'''</span></code></b></li># <li> Restart the VM. Is it working normally?</li># <li> Create compressed backups of your other virtual machines (ie. '''centos1''' and '''centos2''').</li># <li> 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:</li># <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?<br><br/li></ol>
=== Part 2: Restoring Virtual Machines ===

Navigation menu