Cloning VMs and Containers in ProxMox

00:08:41
https://www.youtube.com/watch?v=Wip5EjGo5ME

Resumen

TLDRMike's tutorial elaborates on the process of using templates and cloning within Proxmox, particularly focusing on Windows Server 2019 deployments. He starts by discussing the importance of creating a 'golden image' and explains the differences between cloning from a template versus an existing VM. He details the sysprep process needed for Windows machines to avoid machine ID conflicts and emphasizes best practices, particularly for maintaining an effective golden image. The video concludes with a walkthrough of cloning a template and the associated settings adjustments to streamline the deployment process.

Para llevar

  • 🖥️ Create a golden image for VM deployment.
  • ⚙️ Use sysprep to prepare Windows machines for cloning.
  • 🔗 Linked clones save storage space by sharing OS files.
  • 📦 Converting a VM to a template prevents updates to the template itself.
  • 🔒 Avoid joining the golden image to a domain to prevent conflicts.
  • 📑 Use a batch file to simplify the sysprep process.
  • ⏱️ Monitor cloning progress in Proxmox's task section.

Cronología

  • 00:00:00 - 00:08:41

    In this video, Mike explains how to efficiently clone virtual machines (VMs) and containers in Proxmox, emphasizing the creation of a 'golden image' VM or container as a starting point for cloning. He discusses the difference between converting a VM into a template for linked cloning versus cloning directly from an existing VM, highlighting the pros and cons of each approach. The benefit of using templates includes the option of linked clones, which save storage space, while direct cloning allows for dynamic updates to the golden image. Mike also provides specific tips for preparing a Windows golden image, including installing the QEMU guest agent and using a batch file for the sysprep process, which ensures that cloned machines have new machine IDs and avoids configuration conflicts. He walks through the cloning process step-by-step, demonstrating how to clone a VM, run sysprep, convert a VM to a template for future cloning, and the convenience of creating linked clones from the template. The video concludes with an invitation for viewers to ask questions or report issues.

Mapa mental

Vídeo de preguntas y respuestas

  • What is a golden image?

    A golden image is a master VM or container that has the OS installed and customized before it is cloned for deployment.

  • What is sysprep?

    Sysprep is a Microsoft tool that prepares a Windows installation for cloning by removing system-specific data.

  • What are linked clones?

    Linked clones are clones that share the base disk of the template VM, saving storage space.

  • Can I update a template after it's created?

    No, once a VM is converted to a template, you cannot apply updates directly to it.

  • Why shouldn't I join the golden image to a domain?

    Joining the golden image to a domain can cause conflicts when cloned instances are activated.

  • What changes need to be made in the sysprep batch file?

    You will need to change the reboot flag to 'shutdown' before converting to a template.

  • What happens to local user data after running sysprep?

    Running sysprep deletes the original Windows profile and creates a new one, thus losing locally stored user settings.

  • Is the process different for Linux VMs?

    The sysprep process is not required for Linux VMs during cloning.

  • How can I monitor the cloning progress in Proxmox?

    You can monitor the progress by going to the tasks section and double-clicking on the task to view output.

Ver más resúmenes de vídeos

Obtén acceso instantáneo a resúmenes gratuitos de vídeos de YouTube gracias a la IA.
Subtítulos
en
Desplazamiento automático:
  • 00:00:00
    [Music]
  • 00:00:10
    hey guys welcome to how to do computers
  • 00:00:13
    i'm mike and today we're going over
  • 00:00:15
    templates and cloning in proxmox this
  • 00:00:17
    can be done with vms as well as
  • 00:00:19
    containers and it will save you an
  • 00:00:21
    absolute ton of time with deploying
  • 00:00:24
    multiple instances of the same os the
  • 00:00:26
    first thing you'll want to do is set up
  • 00:00:28
    a golden image for the vm or container
  • 00:00:31
    you want to clone in my case here it's a
  • 00:00:33
    windows server 2019 virtual machine but
  • 00:00:36
    the process is similar for pretty much
  • 00:00:38
    any os cloning a windows vm does however
  • 00:00:41
    require a few extra steps then cloning a
  • 00:00:43
    linux machine but we'll go over those in
  • 00:00:46
    a minute
  • 00:00:47
    first i'd like to go over the difference
  • 00:00:49
    between cloning from a template and
  • 00:00:51
    cloning from an existing vm each one has
  • 00:00:53
    its pros and cons for both you'll start
  • 00:00:55
    off the same you'll set up a vm and
  • 00:00:58
    install the os then you'll make all the
  • 00:01:00
    configuration changes and install all of
  • 00:01:02
    the things that you think that the
  • 00:01:04
    copies will need like a favorite browser
  • 00:01:06
    a guest agent like the proxmox qemu
  • 00:01:09
    agent and of course all updates and or
  • 00:01:12
    repositories you might need now you have
  • 00:01:14
    two options you can convert this to a
  • 00:01:16
    template which can be used to make
  • 00:01:18
    clones or you can leave it as a virtual
  • 00:01:21
    machine and clone it from the vm itself
  • 00:01:23
    when you convert the vm to a template it
  • 00:01:25
    effectively stops being a vm in that you
  • 00:01:28
    can no longer power it on and use it the
  • 00:01:30
    drawback of this is that you'll have no
  • 00:01:32
    way of applying updates installing
  • 00:01:34
    different software or applying
  • 00:01:35
    configurations to the template you would
  • 00:01:37
    have to create a new template to do that
  • 00:01:39
    the greatest benefit to using a template
  • 00:01:42
    is creating what's called a linked clone
  • 00:01:44
    what this does is it allows you to
  • 00:01:46
    create a clone that uses the template as
  • 00:01:48
    a sort of base so that the clone won't
  • 00:01:50
    need to have its own copy of the os
  • 00:01:52
    files or anything else that you've saved
  • 00:01:55
    to the original template it will simply
  • 00:01:57
    read them from the template itself this
  • 00:01:59
    will end up saving a lot of space on
  • 00:02:01
    your storage especially if you plan on
  • 00:02:02
    making many instances of this machine
  • 00:02:04
    keep in mind if you choose to go this
  • 00:02:06
    route you won't be able to delete the
  • 00:02:08
    template if there are any linked clones
  • 00:02:10
    running off of it that means that if you
  • 00:02:12
    want to make a new template with updated
  • 00:02:13
    software and configurations you'll need
  • 00:02:15
    to build everything from scratch on the
  • 00:02:18
    other hand you can simply go with
  • 00:02:20
    cloning the vm as it is the benefit with
  • 00:02:22
    this is that you can make changes to
  • 00:02:24
    your golden image dynamically applying
  • 00:02:26
    needed updates and configurations as you
  • 00:02:29
    see fit if you do this though you'll
  • 00:02:31
    lose the useful ability to create a
  • 00:02:33
    linked clone which means that each time
  • 00:02:34
    you clone the machine it will be taking
  • 00:02:36
    up as much disk space as the original vm
  • 00:02:39
    usually my personal choice for
  • 00:02:41
    production machines is to stick with
  • 00:02:43
    leaving the virtual machine as a virtual
  • 00:02:46
    machine and cloning it when i need to
  • 00:02:47
    deploy a new instance every so often i
  • 00:02:50
    power on the golden image and apply
  • 00:02:52
    updates which makes deploying a new
  • 00:02:53
    machine a little bit faster as i don't
  • 00:02:55
    need to wait for more and more updates
  • 00:02:57
    to apply the older the template gets i
  • 00:02:59
    will however sometimes use a template if
  • 00:03:02
    i need to spin up several test instances
  • 00:03:04
    as they are much faster to create and to
  • 00:03:06
    manage in the short term so let's go
  • 00:03:08
    ahead and go into our server golden
  • 00:03:11
    image open up the console quick side
  • 00:03:13
    note if you're running a domain server
  • 00:03:16
    you shouldn't join the golden image to
  • 00:03:18
    the domain as i've experienced problems
  • 00:03:20
    with this in the past so on this machine
  • 00:03:22
    i've installed a couple of things and
  • 00:03:24
    made sure that it's completely up to
  • 00:03:25
    date with all the security patches i've
  • 00:03:27
    also ensured that all the options and
  • 00:03:29
    hardware settings are appropriately set
  • 00:03:31
    in proxmox so now it's ready to be
  • 00:03:34
    cloned regardless of what you have done
  • 00:03:36
    to the machine i do recommend doing two
  • 00:03:38
    things to your golden image specifically
  • 00:03:40
    with windows the first is ensure that
  • 00:03:43
    the qemu guest agent is already
  • 00:03:45
    installed and second i like to create a
  • 00:03:47
    batch file on the desktop that will make
  • 00:03:49
    the post clone process a little simpler
  • 00:03:52
    so here we have sysprep.bat if we edit
  • 00:03:55
    we can see that it executes sysprep from
  • 00:03:58
    the
  • 00:03:59
    sysprep directory with the flags
  • 00:04:01
    generalize oobe and reboot i'll be sure
  • 00:04:04
    to post this in the description below
  • 00:04:06
    all you'll do is open up an empty
  • 00:04:09
    notepad file paste this into the notepad
  • 00:04:11
    file and then save it as
  • 00:04:13
    sysprep.bat on your desktop and it will
  • 00:04:16
    be ready to run whenever you deploy a
  • 00:04:18
    new image so the reason we run sysprep
  • 00:04:21
    is that whenever you clone a windows
  • 00:04:23
    machine it needs to have a new machine
  • 00:04:25
    id assigned to it or there can be
  • 00:04:27
    conflicts especially if you're running
  • 00:04:29
    them together on a domain there are
  • 00:04:31
    arguments regarding this topic on
  • 00:04:32
    various forums and some people believe
  • 00:04:35
    that this is an unnecessary step however
  • 00:04:37
    my experience has proven otherwise so i
  • 00:04:39
    always assist prep any new windows
  • 00:04:42
    virtual machine
  • 00:04:43
    another note here after you run sysprep
  • 00:04:46
    it will delete the original windows
  • 00:04:48
    profile and create a new one so it won't
  • 00:04:50
    copy profile based configurations like
  • 00:04:53
    folder views taskbar and start menu
  • 00:04:55
    shortcuts or pretty much anything that
  • 00:04:57
    stores configuration data in the local
  • 00:04:59
    user's app data folder it should however
  • 00:05:01
    still preserve installed programs
  • 00:05:03
    drivers updates etc so now in proxmox go
  • 00:05:07
    ahead and go to your node and find the
  • 00:05:09
    golden image first we'll go over a basic
  • 00:05:11
    clone so go ahead and right click select
  • 00:05:14
    clone you'll enter a name vmid and a
  • 00:05:17
    target storage this one is going to be
  • 00:05:19
    our file server so i'll call it svr
  • 00:05:23
    fs01 i'll leave the storage the same as
  • 00:05:26
    the source vm and the vmid as 103. hit
  • 00:05:30
    clone and this may take a little while
  • 00:05:32
    you can monitor the progress by going to
  • 00:05:34
    your tasks double clicking on it and
  • 00:05:37
    watching the output
  • 00:05:39
    so that took right around two minutes to
  • 00:05:41
    copy once it says task okay the vm
  • 00:05:44
    should be cloned and here we go now
  • 00:05:46
    let's select the vm and hit start to
  • 00:05:49
    start it and then we'll let it boot into
  • 00:05:52
    windows
  • 00:05:53
    now if this was a linux machine you
  • 00:05:55
    could simply rename it and be done
  • 00:05:57
    however in windows like i mentioned
  • 00:05:59
    before we need to run sysprep so once
  • 00:06:01
    you're booted in you'll run that batch
  • 00:06:03
    file that we created earlier
  • 00:06:06
    and then let it do its work this process
  • 00:06:08
    usually takes a few minutes and then it
  • 00:06:11
    will reboot so i'll get back after that
  • 00:06:13
    is finished once the computer is
  • 00:06:15
    finished rebooting you'll be brought to
  • 00:06:17
    an initialization screen make sure that
  • 00:06:19
    the appropriate options are set hit next
  • 00:06:22
    click accept and then you'll need to set
  • 00:06:25
    a password
  • 00:06:28
    and hit finish
  • 00:06:30
    so once the sys prep is complete your
  • 00:06:32
    machine should be ready to go now let's
  • 00:06:34
    take a look at templates since i do want
  • 00:06:37
    to keep the original golden image vm
  • 00:06:39
    i've made a clone of it for
  • 00:06:40
    demonstration purposes and named it svr
  • 00:06:44
    2019-template since we won't be allowed
  • 00:06:46
    to make any more changes to the template
  • 00:06:48
    once it's created we can actually go
  • 00:06:49
    ahead and cis prep this machine before
  • 00:06:52
    we convert it into a template this makes
  • 00:06:54
    it so that when we clone it we don't
  • 00:06:55
    need to run sysprep on the clone it'll
  • 00:06:57
    already be initialized so before we run
  • 00:06:59
    the sysprep batch file that we created
  • 00:07:02
    earlier i'll make one adjustment to it
  • 00:07:04
    so go ahead and right click and then hit
  • 00:07:06
    edit and we want to change the reboot
  • 00:07:08
    flag at the end
  • 00:07:09
    to say shutdown
  • 00:07:12
    go ahead and save it
  • 00:07:14
    and then run and now we'll wait once
  • 00:07:15
    again for the assist prep to complete
  • 00:07:17
    except this time it won't automatically
  • 00:07:19
    reboot after it's finished so now that
  • 00:07:21
    the virtual machine has finished the
  • 00:07:23
    sysprep and it is shut down we can right
  • 00:07:26
    click on the vm and then select convert
  • 00:07:28
    to template hit yes and then allow that
  • 00:07:30
    to finish now when you make a clone of
  • 00:07:32
    this template it'll automatically assign
  • 00:07:34
    the machine a new machine id without the
  • 00:07:36
    added step of running sysprep which is a
  • 00:07:38
    bit of a time saver as well so now let's
  • 00:07:40
    go ahead and make a clone of the
  • 00:07:41
    template if you right click on it you'll
  • 00:07:43
    see that the only option available is to
  • 00:07:45
    make a clone so click that we'll give it
  • 00:07:48
    a name for now i'll just call it test
  • 00:07:49
    server
  • 00:07:50
    leave the vmid as 106 and for this we'll
  • 00:07:53
    leave it as a linked clone go ahead and
  • 00:07:56
    clone it
  • 00:07:57
    and unlike a standard clone it should
  • 00:07:59
    create instantly so just like before the
  • 00:08:02
    machine will reboot a couple of times
  • 00:08:04
    and then you'll get the same post
  • 00:08:06
    sysprep initialization screen
  • 00:08:09
    and there we go your linked clone is up
  • 00:08:11
    and running now i won't go over cloning
  • 00:08:13
    or creating templates for containers as
  • 00:08:16
    the process is nearly identical to
  • 00:08:18
    virtual machines that being said i
  • 00:08:20
    believe that is all for now as always
  • 00:08:23
    thanks for watching let me know in the
  • 00:08:24
    comments if you run into any issues or
  • 00:08:26
    if you have any questions and i'll see
  • 00:08:28
    you in the next video
  • 00:08:31
    [Music]
Etiquetas
  • Proxmox
  • cloning
  • templates
  • VMs
  • Windows
  • sysprep
  • golden image
  • containers