13,420
edits
Changes
no edit summary
|}
# Shut down all of the virtual machines.
# Change to the directory <b><code>/var/lib/libvirt/images/</code></b>. 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!)# 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!
# Start the '''''centos3''''' VM.
# '''Make certain that you are in your VM and <u>not</u> in your main system!'''
# >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).# 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>
# 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>
# Restart the VM. Is it working normally?
# Create compressed backups of your other virtual machines(ie. centos1 and centos2).</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:
# Execute the following command: <b><code><span style="color:#3366CC;font-size:1.2em;">virsh dumpxml centos3 >centos3.xml</span></code></b>
# 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># Make We will now learn how to download a compressed image file and xml configuration file and add it as a copy of VM to the virtual manager menu.# Issue the following commands:<ul><li><b><code><span style="color:#3366CC;font-size:1.2em;">centos3wget http://cs.senecac.on.ca/~murray.saul/ops235/practical1.img.xmlgz</span></code></b> called <code/li>centos3a.xml</codeli>.# Edit the file <b><code><span style="color:#3366CC;font-size:1.2em;">centos3awget https://scs.senecac.on.ca/~murray.saul/ops235/practical1.xml</span></code></b>, making the following changes:<br><br></li></ul>::* Change the name (in <ol><li>Copy these files to the file, not the file name) to '''centos3a/var/lib/libvirt/images'''::* Change at least one of the hexadecimal characters in the UUID. Do not change the length of directory and decompress the UUID. Valid hexadecimal characters are 0-9 and a-f.:::Issue this command: image<b/li><codeli><span style="colorMake certain your present working directory is:#3366CC;font-size:1.2em;">virsh define centos3a.xml<'''/var/lib/libvirt/span>images'''</codeli></bli>:::Issue the command :<b><code><span style="color:#3366CC;font-size:1.2em;">virsh list --alldefine practical1.xml</span></code></b> and record any changes.:::Issue </li><li>What happened in the virtual manager window? Launch the command: VM to see if it boots-up<b/li><codeli><span style="color:Can you log into this VM? Perhaps your instructor will give you a clue in week #3366CC;font-size:17...2em >;">virsh undefine centos3ap</span></codeli></bol>
{| width="40%" align="right" cellpadding="10"
|- valign="top"