Operating System - VMware
1748136 Members
3867 Online
108758 Solutions
New Discussion юеВ

Re: Backup a running VM using rsync

 
SOLVED
Go to solution
'chris'
Super Advisor

Backup a running VM using rsync

hi

Has someone tried to backup a running VM from ESX 3.5 using rsync?
7 REPLIES 7
wobbe
Respected Contributor

Re: Backup a running VM using rsync

I just did a quick test with an linux VM running on ESXi4 from NFS storage. The copy booted without any problems. Interesting, very interesting.
'chris'
Super Advisor

Re: Backup a running VM using rsync

@wobbe

How did you copied, have you done using rsync?
wobbe
Respected Contributor
Solution

Re: Backup a running VM using rsync

Yep. I did.

rsync -r /mnt/lv0/linux/ /mnt/lv0/copy/

This was on the NSF storage server using rsync 2.6.8. (CentOS 5.4)
The running VM was also CentOS.
'chris'
Super Advisor

Re: Backup a running VM using rsync

Have you really backup a running VM?

I've tried to backup with rsync directly from ESX 3.5 to an other linux machine and I'm getting these problems:

# rsync -r ssh SRV12 root@192.168.1.11:/var
Password:
rsync: link_stat "/vmfs/volumes/49172c57-524d3fc3-6cfc-001e4f1285d0/ssh" failed: No such file or directory (2)
rsync: send_files failed to open "/vmfs/volumes/49172c57-524d3fc3-6cfc-001e4f1285d0/SRV12/SRV12-000001-delta.vmdk": Device or resource busy (16)
rsync: send_files failed to open "/vmfs/volumes/49172c57-524d3fc3-6cfc-001e4f1285d0/SRV12/SRV12-350c5ca2.vswp": Device or resource busy (16)
Uwe Zessin
Honored Contributor

Re: Backup a running VM using rsync

Chris, he has run rsync inside the VM. Whether that gave a (crash-)consistent result I doubt.

Your command has failed because the files which make up a VM are intentionally locked by the virtualization layer. Even if they were not locked, you would not get a reliable result if the VM makes changes to the life file system.

The work-around is to create a 'snaphot' of the VM. The virtualization layer will create new delta/REDO files into which it stores all data that is written - this means that the original file is not changed so you can create a 'crash-consistent' copy. Well, and of course it now unlocks the files so you can read from them.

After the backup is complete, delete the snapshots and all writes collected in the delta/REDO files will be merged to the original disk. And the files will be locked again ;-)
.
'chris'
Super Advisor

Re: Backup a running VM using rsync

Can I do it a snapshot of a running VM using rsnapshot from http://rsnapshot.org/ ?
Uwe Zessin
Honored Contributor

Re: Backup a running VM using rsync

It is my understanding that rsnapshot's idea is to create a full backup of file systems and then make incremental backups which look like other full backups due to using hard links for files already copied.
I think today's buzzword is 'de-duplication' :-)

The main data of a VM is encapsulated in one or more large files. You cannot really do 'incremental backups' - well, with ESX4 and changed block tracking it is possible, but that is just a framework, no complete application.


Chris, can we step back a moment and have a better look at your configuration (what OS and data is in the VM) and requirements for backups? Maybe there is a 'better' way to do backups than running rsync - the ESX service console is not a generic Linux environment for all kinds of applications.
.