230 likes | 451 Vues
VMs. Virtual Machines. VM . What is a VM V irtual M achine Software implementation of a machine running on another machine The VM may or may not resemble the host machine E.g. Linux on a Windows machine Windows on Windows MVS on VM (IBM mainframe)
E N D
VMs Virtual Machines
VM • What is a VM • Virtual Machine • Software implementation of a machine running on another machine • The VM may or may not resemble the host machine • E.g. • Linux on a Windows machine • Windows on Windows • MVS on VM (IBM mainframe) • Linux (Intel Style) on MVS (IBM Mainframe)
Why VMs • Emulate software or hardware not available • Reduce costs • Reduce exposure • In a hostile environment • If machine becomes infected • Reboot (reload) VM • Test new environments • If mess up, just reboot (reload) VM • Isolate programs/environments • Adjust loads • Move/Start new VM’s to new/different servers as needed
VMWare View of Benefits • Compatibility: • Virtual machines are compatible with all standard x86 computers • Isolation: • Virtual machines are isolated from each other as if physically separated • Encapsulation: • Virtual machines encapsulate a complete computing environment • Hardware independence: • Virtual machines run independently of underlying hardware
VM downside • More complicated environment • Need to be aware of licensing issues • Virtual machine might not 100% emulate a physical machine • Performance • Extra cost of the VM software
VM Brief History • Started on Mainframes • Late 1960’s – early 1970’s • Help develop OS for the IBM 360 and followons • Realized it could be used for “real-world” applications • Became practical on PC’s in the last 10 years
VM Types • System virtual machines • Have an underlying physical machine • Runs one or more virtual machines • Each potentially running a different operating system • AKA hardware virtual machines • Hypervisor: • Software layer providing the virtualization • AKA - virtual machine monitor • Type 1 hypervisor • Runs on bare hardware • AKA - Native VM • Type 2 hypervisor • Runs on top of an operating system • AKA - Hosted VM
VM directory (/scratch) Debian Image CentOS Image Simple Type 2 Example PCnn (local workstation) Debian Linux OS
/scratch Debian CentOS install Original VM Creation NFS “Common Directory” (Read Only) PCnn (local workstation)
Each VM • Each VM • Only exists on the targeted PC after installed • Cannot write back to the source NFS directory • Read only • How to save?
Saving VMs • Every lab workstation you log onto has a network directory: network_storage • That network directory is located on the NFS server drive • That network directory will follow you to any machine in the lab you log onto • Actually follows the login ID • Copy the VM to the network directory and run? • Two problems: • Sometimes the VM won’t work properly from an NFS Drive • Changes to the VM are “permanent” • Make an error in the change saved version now has the error • Bigger problem • VM dies when workstation removed from the lab network!
Saving VMs • Solution: • Make a copy of your VMs (Debian and CentOS) to your network NFS drive • “One time” copy • Backup copy • Put in aptly name directories: • myuseridDebian • myuseridCentOS • Takes about 3-6 minutes to copy per OS • Longer if there is a lot of network traffic
/scratch Debian CentOS Saving the VMs on local PC to network file NFS “network directory” Debian CentOS PCnn (local workstation)
Saving VMs • “Restoring” VM to a workstation • Copy OS image of interest • From the network NFS directory • To the local /scratch directory • Takes about 5 minutes to copy down • Depends on network load • To save changes to the VM • Think carefully: do you want to save these changes? • Copy the image back to the NFS server drive
/scratch Debian CentOS Copying the VMs to local PC network directory Debian CentOS PCnn (local workstation)
Version management • When done testing a VM on the local PC • Decide if you want to save the image: • Yes • Copy contents back to network directory • No • Do nothing or delete entry in /scratch
USB Drives • The same is true for USB drives to keep copies • Advantage: • Can take home with you • Not effected if home_directory disappears • Disadvantage • Can easily loose • May break
Home directory Space • “Home” directory • On the desktop • On the local hard drive • a.k.a. your userid • Network Directory • on the NFS server • Make a copy for each OS to the Network Directory • Have about 12Gb available for your use on the NFS drive • About 2 OSs worth • The basic files: • .vmx • .vmdk • Rest contain history, changes, etc. • Not required but should copy
Ground rules • The PC’s /scratch directory is temporary • Don’t rely on contents being available next time • Directories or data in /scratch may be deleted at any time • When space is needed • Clean up after yourself • Get rid of any directory you are done with • Remember to properly shut down VM before saving or logging off PC • May not save latest changes • May corrupt images
Sanity Rules • NEVER run VM from network_storage directory • It will start • It will fail at the most critical time • It will corrupt your VM • Don’t run VM from USB device • It will start • It may fail • It may corrupt your VM • Start VM from its native directory • Sometimes the VMPlayer doesn’t make it clear where the image it is starting resides • Note: USB devices may be accessed by: • The workstation • A VM • BUT NOT BOTH at the same time! • If the VM uses it the workstation will loose access! • the VM will die if you have started the VM from it!