12 Replies Latest reply: May 8, 2014 3:42 PM by budachst RSS

    How to backup and restore a VM guest using OS commands

    User13493023-Oracle

      In OVM 3.2. Storage is ZFS. I have a VM guest of which I need to take a "gold" copy.

      This is a demo environment so after each demo I need to get the VM guest to its original state, using the "gold" copy.

      Unfortunately I can't use snapshot technology (many other VM on the same volume) and therefore I have to use OS commands to backup and restore.

      I am a newbie at this so bear with me; I need detailed steps on how to proceed to map my VM Id to the disk/directory/fs (???) that I need to backup and restore.

      Can anyone help me with this? Thanks in advance

        • 1. Re: How to backup and restore a VM guest using OS commands
          budachst

          Using ZFS or not, doesn't actually matter here, since ZFS will be transparent to OVM. To obtain a "gold" copy of your VM, you'd make a clone or better yet, a template of it, once you have finished configuring it. This will provide you with an option to create fresh clones from that template using OVM Manager.

          • 2. Re: How to backup and restore a VM guest using OS commands
            user12273962

            Why can't you use a snap shot? You can create snaps at the share or LUN level with ZFS. Export the snap to a share and do whatever to your virtual disk.

             

            You could also create LUN/Share (I personally would use NFS) just for this VM.... then snap away. Roll backs will only affect that repo. ZFS is the boom....

            • 3. Re: How to backup and restore a VM guest using OS commands
              budachst

              Nobody has to argue with me about ZFS being the most advanced fs on this planet… I was merely pointing out the on-board tools of OVMM, since most people tend to have enought to cope with the concepts, when starting with OVM in the first place…

              • 4. Re: How to backup and restore a VM guest using OS commands
                User13493023-Oracle

                I don't think cloning is the way to go. I need to be able to restore my gold copy without having to reconfigure (same IP addresses, etc ...)

                As for using snapshots, I am using a existing environment and the admin is telling me that all VMs are contained within the same "Volume", which means that snapshot will snapshot all VMs and a snapshot rollback will rollback ALL VMs as well, which is obviously not what is wanted.

                I was hoping that someone could help me with steps towards the solution evoked in the WP: Oracle VM 3: Backup and Recovery Best Practices Guide, page 23:

                <<<<<Preferred backup methods for Oracle VM
                The choice of backup methods and technology used in your environment is completely up to you. For the purposes of this guide, products basically fall into three categories of backup technologies:
                 Linux tools – This includes such system applications such as cpio, dd, dump, tar, gzip, zip etc.

                etc ...>>>>>>

                 

                I understand OS commands are  not the favored method, but clone does not seem to answer the question and snapshot is not a possibility.

                • 5. Re: How to backup and restore a VM guest using OS commands
                  user12273962

                  I agree budachst. I was really responding to the OP. Sorry I didn't make that clear.

                  • 6. Re: How to backup and restore a VM guest using OS commands
                    user12273962

                    I don't know why your storage admin is lying to you. All the VMs do NOT have to be on the same volume. IF your storage admin is using best practices.... Then he has dozens of disk all in the same storage pool. He then can slice them ever how he chooses to slice them. Best practices dictate you create very few storage pools. The more disks in the pool the better. He's just not wanting to slice them any different than what he is already doing.

                     

                    You can snapshot the existing Volume. Export that snapshot to a NFS share... and then manually copy the virtual disk from the share. You then have perfect backup of the existing virtual disk... or better yet. Enable http sharing on your ZFS appliance. Share the snapshot you just created and then..... You can then point directly at the virtual disk snap for import in the existing repo.

                    • 7. Re: How to backup and restore a VM guest using OS commands
                      budachst

                      @

                       

                      @: I don't think that the storage admin is actually lying to you, but it could be that he really doesn't understand your demands. On the other hand, I really don't get your objective to using the provided tools by OVMM. If you're using OCFS2, you can clone a vdisk, which will result in a reflink operation on that vdisk. This will create a COW copy of your vdisk and should you ever want to go back to that state, the action plan would simply involve to perform another clone on that disk, throw away the current one and connect the former clone - now "promoted" to the working copy. You'd not even had to change anything else in the VM config.

                       

                      If you'd wanted to automate this, you will have to take a look at the ovm-utils, which should be able to do this through the cli.

                      • 8. Re: How to backup and restore a VM guest using OS commands
                        User13493023-Oracle

                        Thank you. So to go back to my original question, where do I find (directory path ???) the virtual disk for a specific VM?

                        • 9. Re: How to backup and restore a VM guest using OS commands
                          budachst

                          Each VM is represented by a UUID, which you can get from OVMM when you click on the triangle and thus reveal the details of that guest. This UUID will be the name of the folder where the vm.cfg is stored on your repository, which in turn also sports a UUID… as you can see, OVMM uses UUIDs a lot, which makes the handling suitable for algorithms, but not for humans…

                           

                          However, you can find the location of the vm.cfg file of a guest by simply running this on the OVM server, where this guest is running on:

                           

                          grep -Ri [name of vm] /OVS/Repositories/*/VirtualMachines

                           

                          Note, that the VMs are not kept all in one in one folder, but OVM aggregates the vm.cfg files and the vdisk seperately. The vm.cgf files will reside unter VirtualMachines/[UUID of guest] while all vdisks in one repo will reside unter VirtualDisks/[vdisk]. So any attempt to backup a single VM completely would need to take that into account.

                          • 10. Re: How to backup and restore a VM guest using OS commands
                            User13493023-Oracle

                            I think your last suggestion is a great idea. Will the import be faster than the cpio from Vdisk copy to Vdisk origin?

                            What happens once the import is done? I assume that  I need to edit the VM, delete the old Vdisk and add the newly imported one. Am I correct?

                            • 11. Re: How to backup and restore a VM guest using OS commands
                              User13493023-Oracle

                              Great. That is exactly what I needed. Thank you.

                              • 12. Re: How to backup and restore a VM guest using OS commands
                                budachst

                                Nothing beats a reflink-operation on an OCFS2 volume… Ans yes, you'd need to edit the VM config. I'd assume, that this can be also done through in the terminal utilizing the ovm-utils, on the other hand the amount of involvement is quite low, just having to swap out the old vdisk and grab  the new one.