Find the answer to your Linux question:
Results 1 to 5 of 5
I have a question about backing up KVM images while they are still running. I have tried this for a Windows 2003 image and it appears to be working. I ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Apr 2009
    Posts
    24

    KVM images and backing up to another server


    I have a question about backing up KVM images while they are still running. I have tried this for a Windows 2003 image and it appears to be working. I am planning on backing up a CentOS image (once a week) while it is still running on one server to the another in case something happens with server that is running it. My question is while the transfer is happening is the VM locked? If it isn't what kind of corruption can happen to a 75GB image?

    Any help would be appreciated.

    Nick

  2. #2
    Linux Newbie nplusplus's Avatar
    Join Date
    Apr 2010
    Location
    Charlotte, NC, USA
    Posts
    106
    To answer your first question, I would say it depends on how you are doing the backup. In the past, I have backed up KVM images using LVM snapshots. You take a snapshot of the volume the image resides on, mount the snapshot, then backup the image from the snapshot. The image on the snapshot is a point-in-time copy of the running image, and does not require any locking of the source image. If the source image were locked, the guest would not be able to run anymore.

    The downside of this is that the image is said to be "crash consistent," which means any file changes that were in memory and had not yet been written to disk will now be lost. Therefore, this method is highly dependent on the nature of the services being provided by the guest you are backing up. If you are running a high transaction database server, you will likely want to augment this backup method with a native backup of your database to another host, or avoid this kind of image-based backup altogether. If you are running an app or web server with few filesystem changes, this is an ideal method of backup.

    However, whatever the case, Linux images restored from such backups are going to want to run fsck on boot and will likely report some orphaned inodes, which is likely fine as long as the virtual disk is recoverable. A journaling file system (think ReiserFS or EXT3/4) will definitely help in this case. On the other hand, you might find Windows images restored from such backups might be hooped, like pulling the power cord out of the back of a bare metal Windows machine. Ouch...

    N

  3. #3
    Just Joined!
    Join Date
    Apr 2009
    Posts
    24
    Thanks for the response. What I was thinking was using SCP to just copy the image. This is going to be a CentOS VM which is running a reporting server for Oracle so only log files will be changing.

    I'm not concerned about having the latest logs on that other server, just to be able to start it in the event that server 1 fails.

  4. #4
    Linux Newbie nplusplus's Avatar
    Join Date
    Apr 2010
    Location
    Charlotte, NC, USA
    Posts
    106
    In that case, I would say your best bet would be to take a volume snapshot, mount the snapshot, rsync the image that lies on the snapshot to your destination, unmount the snapshot when done, then remove the snapshot. In either case, using rsync (even over ssh) will likely be more efficient than scp, and using a snapshot instead of just scp'ing the live image will likely result in fewer orphaned inodes and corrupt blocks. I am surprised you are doing this with a Windows image and have successfully recovered to it.

    I have a script on my pitiful blog that does just what I describe above, in addition to mounting the guest's filesystem inside the image for a guest file-level backup from the host. In my case, I called the script from the backup software I was using, but it could just as easily be done from a cron job in combination with rsync. It will need modification to not mount the guest's file system.

    Tech @ Thou Art Pop: Backing Up Xen Guests via LVM

    N

  5. #5
    Just Joined!
    Join Date
    May 2012
    Location
    Novosibirsk
    Posts
    9
    Hi guys. I have a question about pause KVM. Is any way to freeze a current state of KVM container like snapshot in VMware?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •