CentOS7 KVM backup VMs - shutdown VMs

General support questions
Post Reply
makgab
Posts: 21
Joined: 2014/03/03 15:08:37

CentOS7 KVM backup VMs - shutdown VMs

Post by makgab » 2014/11/10 17:44:45

Hi!

There is a server with CentOS7 (x64 sotfware raid1).
How can I backup/snapshot from VMs? (It may live backup.)
I would like to solve it from cron, if it works.

I try it with virsh to shutdown, rsync the img, restart , for example:

Code: Select all

# virsh shutdown CentOSVM1
* But the shutdown is not working. It is still running. Is it acpid problem? But acpid is installed on VMs.
* Or can I use the "virsh save CentOSVM1" and make a copy with rsync? It is will be a consistent state?

Have anybody got a good backup script?
--
G.

drk
Posts: 405
Joined: 2014/01/30 20:38:28

Re: CentOS7 KVM backup VMs - shutdown VMs

Post by drk » 2014/11/11 21:48:29

Using LVM?

Try these steps:
- virsh dumpxml guest > /path/to/save/guest.xml
- virsh save guest > /path/to/save/guest.state
- create your LVM snapshot for the guest's disk(s)
- virsh restore /path/to/save/guest.state
- use dd to read the snapshot and back it up eg "dd if=/dev/mapper/guest-snapshot bs=1M | gzip > /path/to/save/guest.d1.gz"
- remove LVM snapshot(s)
- gzip /path/to/save/guest.state

now you have a coherent snapshot of a running guest and the guest itself is only interrupted momentarily.

makgab
Posts: 21
Joined: 2014/03/03 15:08:37

Re: CentOS7 KVM backup VMs - shutdown VMs

Post by makgab » 2014/11/11 22:17:00

I don't use LVM, only sw raid1.

But I found a soultion! The rear app: http://relax-and-recover.org/

It is great!!
--
G.

drk
Posts: 405
Joined: 2014/01/30 20:38:28

Re: CentOS7 KVM backup VMs - shutdown VMs

Post by drk » 2014/11/12 18:07:15

makgab wrote:I don't use LVM, only sw raid1.
Change the LVM snapshots to cp's of your disk image files then.
But I found a soultion! The rear app: http://relax-and-recover.org/

It is great!!
For the host machine, sure, but you're not backing up the guest VMs correctly if they are running.

makgab
Posts: 21
Joined: 2014/03/03 15:08:37

Re: CentOS7 KVM backup VMs - shutdown VMs

Post by makgab » 2014/11/12 18:26:26

drk wrote: For the host machine, sure, but you're not backing up the guest VMs correctly if they are running.
It seems perfect... :)
--
G.

drk
Posts: 405
Joined: 2014/01/30 20:38:28

Re: CentOS7 KVM backup VMs - shutdown VMs

Post by drk » 2014/11/13 04:56:47

makgab wrote:
drk wrote: For the host machine, sure, but you're not backing up the guest VMs correctly if they are running.
It seems perfect... :)
:shock: If your guest was running while its disk image was being backed up then you do not have a "perfect" backup.

makgab
Posts: 21
Joined: 2014/03/03 15:08:37

Re: CentOS7 KVM backup VMs - shutdown VMs

Post by makgab » 2014/11/14 06:18:13

drk wrote: If your guest was running while its disk image was being backed up then you do not have a "perfect" backup.

The rear was installed in VM and it make whole backup about itself (about VM) online. Make boot ISO image, and backup.tar.gz to remote server.
It seems very good!
--
G.

drk
Posts: 405
Joined: 2014/01/30 20:38:28

Re: CentOS7 KVM backup VMs - shutdown VMs

Post by drk » 2014/11/15 02:43:49

makgab wrote:The rear was installed in VM and it make whole backup about itself (about VM) online. Make boot ISO image, and backup.tar.gz to remote server.
It seems very good!
Oh, I see.Ya, that will work from within the guest :)

Post Reply

Return to “CentOS 7 - General Support”