VM Templates and Clones: Difference between revisions

From Proxmox VE
Jump to navigation Jump to search
m (link to centos7 guide)
(→‎OS specific notes for Templates: restrictive OS notes only for productive usage)
Line 26: Line 26:


=== OS specific notes for Templates ===
=== OS specific notes for Templates ===
A template should not include any data, user accounts or SSH  keys so you need to remove all before you convert the VM to a template. On Linux systems you need to remove SSH host keys, persistent network MAC configuration and user accounts and user data. Windows offers a bunch of tools for this, e.g. sysprep.
For productive usage it is highly recommended that a template does not include any data, user accounts or SSH  keys so you should remove all before you convert the VM to a template. On Linux systems you should remove SSH host keys, persistent network MAC configuration and user accounts and user data. Windows offers a bunch of tools for this, e.g. sysprep.
 
For testing purposes it may be useful to use a fully installed OS as a template.


==== GNU/Linux ====
==== GNU/Linux ====

Revision as of 09:09, 13 October 2016

Introduction

A template is a fully pre-configured operating system image that can used to deploy KVM virtual machines. Creating a special template is usually preferred over cloning an existing VM.

Deploying virtual machines from templates is blazing fast, very comfortable and if you use linked clones you can optimize your storage by using base images and thin-provisioning.

Proxmox VE includes container based templates since 2008 and beginning with the V3.x series, additionally KVM templates can be created and deployed.

Definitions

  • VM - KVM based virtual machine
  • Templates - Templates are pre-configured operating system environments that deploy in a couple of clicks
  • Linked Clone - A linked clone VM requires less disk space but cannot run without access to the base VM Template
  • Full Clone - A full clone VM is a complete copy and is fully independant to the original VM or VM Template, but requires the same disk space as the original.

Create VM Template

Templates are created by converting a VM to a template.

  1. Install your VM with all drivers and needed software packages
  2. Remove all user data, passwords and keys - In order to do this run sysprep on Windows or similar tools or scripts on Linux and just power-off the VM.
  3. Right-click the VM and select "Convert to template"

Note

As soon as the VM is converted, it cannot be started anymore and the icon changes. If you want to modify an existing template, you need to deploy a full clone from this template and do the steps above again.

OS specific notes for Templates

For productive usage it is highly recommended that a template does not include any data, user accounts or SSH keys so you should remove all before you convert the VM to a template. On Linux systems you should remove SSH host keys, persistent network MAC configuration and user accounts and user data. Windows offers a bunch of tools for this, e.g. sysprep.

For testing purposes it may be useful to use a fully installed OS as a template.

GNU/Linux

  • Ubuntu: e.g. install with 'OEM mode' (press F4)
  • CentOS7: Most steps in this guide are valid for PVE too.

Windows 7

Deploy a VM from a Template

Right-click the template and select "Clone".

Full Clone

A full clone VM is a complete copy and is fully independant to the original VM or VM Template, but requires the same disk space as the original.

Linked Clone

A linked clone VM requires less disk space but cannot run without access to the base VM Template.

Linked Clones works for theses storages: files in raw, qcow2, vmdk format (either on local storage or nfs); rbd, sheepdog, nexenta.

It's doesn't work for LVM && ISCSI storages

Video Tutorials

tbd: Proxmox VE Youtube channel

Troubleshooting