13,420
edits
Changes
no edit summary
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.<br>eg. '''gzip < centos3.img > ~YourUserId/centos3.img.backup.gz''' (Use the redirect symbols!!!!)</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).<br>eg. '''virsh dumpxml centos3 > centos3.xml'''<br><br></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>There are four general processes to restore your backed-up VMs:<ol><li>eg. Copy '''centos3.img.backup.gz''' from your USB to your <u>images</u> diretory</li><li>Issue command in <u>images</u> directory: '''gunzip < ~YourUserId/centos3.img.backup.gz > centos3.img'''</li><li>Copy '''centos3.xml''' from your USB to your <u>images</u> directory</li><li>In the <u>images</u> directory issue the command: '''virsh define centos3.xml'''</li></ol><br><br>Failure to take the time to make and confirm backups can result in loss of lab work for the student!
== Managing VMs with Shell Scripts ==
Refer to the shell scripting section in lab 2 to see how shell scripts can use the virsh command to start and stop VMs automatically.