XCP-ng
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Backup a VM with all its snapshots?

    Scheduled Pinned Locked Moved Xen Orchestra
    14 Posts 4 Posters 3.3k Views 4 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Z Offline
      Zevgeny
      last edited by

      Hi, is there any way to make a backup (or copy) of a VM, with all of its snapshots included as well?

      Such that when you restore (or view its copy) the snapshot list is preserved exactly?

      1 Reply Last reply Reply Quote 0
      • olivierlambertO Online
        olivierlambert Vates 🪐 Co-Founder CEO
        last edited by

        If you do a backup with XO, then it's like you have all the snapshot saved in the backup repository.

        Z 1 Reply Last reply Reply Quote 0
        • Z Offline
          Zevgeny @olivierlambert
          last edited by

          @olivierlambert Hi, I finally got around to testing this.

          • In XO, I go to the "Backup" section, and out of the backup types, I choose "Backup".

          • I select my NAS as the destination remote.

          • I choose a VM that has snapshots.

          • I select Create and manually run the backup. After its done:

          • I go to the Backup section in XO and select "Restore".

          • I choose the VM I just backed up, and select the "Full" backup to restore.

          • I restore to another host.

          • Looking at the restored VM on the new host, there is nothing in the snapshots section.

          Is this supposed to work? Am I doing something wrong?

          Thanks

          1 Reply Last reply Reply Quote 0
          • olivierlambertO Online
            olivierlambert Vates 🪐 Co-Founder CEO
            last edited by

            You restore a VM entirely, not a snapshot. I'm not sure to understand what do you expect?

            Z 1 Reply Last reply Reply Quote 0
            • Z Offline
              Zevgeny @olivierlambert
              last edited by Zevgeny

              @olivierlambert Going back to my original question, I have a VM in XO with a few snapshots in its snapshot tab.

              Is there a way to backup and restore the VM, such that everything is the same as before the backup (ie. a VM in XO with those particular snapshots in its snapshot tab.)

              I'm struggling to express myself more clearly than this, is it clear what I'm trying to ask? I want the snapshots to be backed up and restored along with the VM, so everything appears the same as the original in the XO GUI.

              1 Reply Last reply Reply Quote 0
              • olivierlambertO Online
                olivierlambert Vates 🪐 Co-Founder CEO
                last edited by

                Each snapshot is a VM per itself. If you want to be able to restore a backup from scratch with multiple date in the past, that's the "retention" number when you configure a backup job.

                But no, you can't simple restore a VM from 0 with all its previous snapshots. The way to be able to restore at multiple points in the past is just called "retention", no problem to restore the same VM from different date if you like šŸ™‚

                Z 1 Reply Last reply Reply Quote 0
                • Z Offline
                  Zevgeny @olivierlambert
                  last edited by Zevgeny

                  @olivierlambert Thanks for the reply.

                  Hmm, we use snapshots as a specific record of certain named changes to our VMs, which we sometimes need to revert back to. Eg. (1) Base OS (2) Drivers and Apps installed (3) Prior to OS update (4) Post OS update, etc. Retention based on dates doesn't quite cover our use case.

                  There doesn't seem to be a way to backup a snapshot via the regular backup system, the only way is to export as XVA or copy it into its own VM entry?

                  Is there any way to populate the snapshots tab of a VM with exported / copied snapshots?

                  In VirtualBox, snapshots are a series of differencing images that only consume enough HD space to record changes. Is this not the case with XCP / XO? Is each snapshot a full standalone copy of the VM?

                  1 Reply Last reply Reply Quote 0
                  • olivierlambertO Online
                    olivierlambert Vates 🪐 Co-Founder CEO
                    last edited by

                    A backup is done via a snapshot šŸ˜‰

                    And yes, a snapshot is using copy on write. But what I'm explaining, is that your chain of snapshot is stored externally, on the backup storage, with the retention you like.

                    It's the first time I heard the use case of restoring a VM with all its previous snapshot šŸ¤” It's not technically impossible, but it's… weird (at least new) to me.

                    ForzaF 1 Reply Last reply Reply Quote 0
                    • ForzaF Online
                      Forza @olivierlambert
                      last edited by Forza

                      @olivierlambert said in Backup a VM with all its snapshots?:

                      A backup is done via a snapshot šŸ˜‰

                      And yes, a snapshot is using copy on write. But what I'm explaining, is that your chain of snapshot is stored externally, on the backup storage, with the retention you like.

                      It's the first time I heard the use case of restoring a VM with all its previous snapshot šŸ¤” It's not technically impossible, but it's… weird (at least new) to me.

                      It's not weird. We use this for application data - being able recover a version of a specific configuration, dataset or program version is quite useful. Like CVS/GIT, but for appllication data. Why not the same for VMs? šŸ™‚ I like this idea - to be able to preserve these versions with custom names etc.

                      Today I snapshot and export VMs to preseve specific states when I make bigger application upgrades/changes.

                      G 1 Reply Last reply Reply Quote 0
                      • olivierlambertO Online
                        olivierlambert Vates 🪐 Co-Founder CEO
                        last edited by olivierlambert

                        You can already do that with snaps (to rollback).

                        But recover a VM from scratch is an operation happening because you lost it. Shouldn't be your everyday operation Oo

                        ForzaF Z 2 Replies Last reply Reply Quote 0
                        • ForzaF Online
                          Forza @olivierlambert
                          last edited by

                          @olivierlambert absolutely. But due to performance or space usage it might not be practical to save many snaps on main SR.

                          Though, making instant clones might be a better choice here?

                          1 Reply Last reply Reply Quote 0
                          • G Offline
                            gsrfan01 @Forza
                            last edited by

                            @Forza

                            It sounds like it may be beneficial to take a backup of the VM instead of a snapshot. It wouldn't preserve the chain and a store wouldn't be instant like a snapshot, but it might work for what you're doing?

                            Normally, from my understanding, snapshots really should be temporary as performance degrades the more you have.

                            1 Reply Last reply Reply Quote 0
                            • Z Offline
                              Zevgeny @olivierlambert
                              last edited by Zevgeny

                              @olivierlambert I think the other commenter put it nicely - we are using snapshots a little bit like version control for the VMs. One of the things we use VMs for is to build golden images for desktop PCs, so maybe that's an unusual use case...

                              Putting aside how it works under the hood, it's also a GUI thing - it's a nice way to view and organize past versions of the VM, by having a list inside the VM's snapshots tab. It would be messier and less clear if they were separate VMs in the main list or exported XVAs.

                              Not being able to backup and restore the snapshots list is a little bit like losing our version control if a disaster happened to XO. I guess we'll have to stop using this feature in this way, or make more effort to manually export the snapshots we really need to back up.

                              Also, can you please confirm / deny what the previous commenter (gsrfan01) said? Is there a performance reduction when having snapshots on a VM's list?

                              G 1 Reply Last reply Reply Quote 0
                              • G Offline
                                gsrfan01 @Zevgeny
                                last edited by

                                @Zevgeny

                                For a few snapshots it's fine - the issue comes when you have large numbers. Most of my first-hand experience with this specific issue comes from Hyper-V but the logic applies here.

                                This is from VMware but the concept is the same and has some good reading on snapshots in general.

                                Running a virtual machine on a snapshot for extended periods of time can cause instability and data loss.
                                https://kb.vmware.com/s/article/1015180

                                The underlying issue stems from the nature of snapshots. With none you have a single VHD containing all of the data for the VM, once you take a snapshot a new delta VHD is created with all new data written going forward from the time of the snapshot. So, in order to have a complete VM you have the original VHD + the delta VHD.

                                This is fine in smaller numbers, but once you start having 10, 15, 20+ snapshots, every one of those represents an additional VHD in the chain. This results in performance degradation because you're reading from multiple potential files as only new data is written to the deltas.

                                This is actually from XO's blog: https://xen-orchestra.com/blog/xenserver-coalesce-detection-in-xen-orchestra/

                                1 Reply Last reply Reply Quote 0
                                • First post
                                  Last post