gbullman
Expert
Expert

Time Machine Backups of Virtual Machines

A note for those who believe Leopard's Time Machine is backing up their VMware Virtual Machines, they are likely not being backed up in any usable form.

VMware Fusion is tagging each virtual disk file, and other critical VM files with a metadata value that prevents Time Machine from backing them up. If, in Terminal, you cd to the directory of one of your Virtual Machines and run the command ls -l@ you will discover this metadata value has been attached to some files;

com.apple.metadata:com_apple_backup_excludeItem

I haven't been able to determine if this metadata setting has been available since Leopard 10.5, or whether it was added in 10.5.1, or 10.5.2. If you've been using using Time Machine and Fusion for a while you may have some older backups, but certainly not after one of those OS updates were applied.

Given that any backups while the VM is running are pretty much useless anyway it does make sense to exclude VMs from Time Machine Backups. What bothers me is that has not been made clear to users of VMWare Fusion so they take the proper steps to ensure their VMs are backed up. I assumed any time that Time Machine ran and I did not have any virtual machines running I was getting a good backup, luckily I found that I wasn't before I had to depend on a backup.

Hope this information prevents headaches for someone out there.

0 Kudos
27 Replies
admin
Immortal
Immortal

I haven't been able to determine if this metadata setting has been available since Leopard 10.5, or whether it was added in 10.5.1, or 10.5.2. If you've been using using Time Machine and Fusion for a while you may have some older backups, but certainly not after one of those OS updates were applied.

I believe the exclusion attribute has existed since 10.5, but Fusion didn't start using it until 1.1 or 1.1.1. The reason is not so much that backing up virtual machines isn't such a great idea (because they're large, you have to back up the entire file, and the on-disk state might not be consistent if the virtual machine is running), but rather an Apple bug that can cause the system to freeze/beachball and requires a hard reboot, which can in turn cause you to lose data.

I agree we need to document this behavior better, and I (and others) have been griping about it internally.

0 Kudos
stsanford
Contributor
Contributor

I have been using Backup (the software that you use with .mac) to backup my VMs to the same External USB drive that I have my Time Machine data on. I just backup to a folder off of the root named Virtual Machines. I just make sure that my VMs are off when the backup runs. Ideally, I'd love a way to automate the shutdown, backup and subsequent restart.

-Scott

0 Kudos
admin
Immortal
Immortal

I've just received word that 10.5.2 apparently fixes the problem with Time Machine (e.g. see http://docs.info.apple.com/article.html?artnum=306853 - it's for Aperture, but we believe the underlying cause to be the same and QA says it's good now). Here is how to manually enable Time Machine:

  1. Use xattr to remove the following attribute from existing files: com.apple.metadata:com_apple_backup_excludeItem

  2. Edit ~/Library/Preferences/VMware Fusion/config to contain the following line so that this attribute does not get re-added

fileMacos.timemachine.enable = "TRUE"

Note that even though the Apple bug is fixed, you might still not want to enable Time Machine because virtual machines are big.

0 Kudos
todivefor
Enthusiast
Enthusiast

I don't have a config file only preferences. Do I create a config file with this as the only entry?


Macbook Air M1, Monterey 12.6, Fusion Player Preview 22H2
0 Kudos
WoodyZ
Immortal
Immortal

I don't have a config file only preferences. Do I create a config file with this as the only entry?

It is just a plain text file so you can use any text editor and save it as plain text.

0 Kudos
manfredell
Enthusiast
Enthusiast

Hi,

can you please inform the command line to use for xattr?

Thanks

0 Kudos
manfredell
Enthusiast
Enthusiast

I used the following:

xattr -d com.apple.metadata:com_apple_backup_excludeItem *

I think that it did remove the metadata because using xattr -l * didn't show them any more.

I created a config with the entry in the folder you mentioned. Restarted Fusion and checked again with xattr -l *

Windows XP Professional.vmem: com.apple.metadata:com_apple_backup_excludeItem:

0000 62 70 6C 69 73 74 30 30 5F 10 11 63 6F 6D 2E 61 bplist00_..com.a

0010 70 70 6C 65 2E 62 61 63 6B 75 70 64 08 00 00 00 pple.backupd....

0020 00 00 00 01 01 00 00 00 00 00 00 00 01 00 00 00 ................

0030 00 00 00 00 00 00 00 00 00 00 00 00 1C .............

Windows XP Professional.vmss: com.apple.metadata:com_apple_backup_excludeItem:

0000 62 70 6C 69 73 74 30 30 5F 10 11 63 6F 6D 2E 61 bplist00_..com.a

0010 70 70 6C 65 2E 62 61 63 6B 75 70 64 08 00 00 00 pple.backupd....

0020 00 00 00 01 01 00 00 00 00 00 00 00 01 00 00 00 ................

0030 00 00 00 00 00 00 00 00 00 00 00 00 1C .............

etc

Looks like it put the metadata again there, so the switch in the config file is ignored/not read!?

0 Kudos
admin
Immortal
Immortal

Looks like it put the metadata again there, so the switch in the config file is ignored/not read!?

Are you sure you created a file called "config", not "config.txt"?

0 Kudos
manfredell
Enthusiast
Enthusiast

Just checked. The extension was hidden, as I never entered it and it was automatically appended I didn't see it.

Yes it was .txt

Removed. All OK.

0 Kudos
khe91
Contributor
Contributor

I removed the attributes with xattr and put

fileMacos.timemachine.enable = "TRUE"

in the preferences file (without .txt).

But the attributes gets re-added with every Fusion start.

What can be the reason ?

0 Kudos
admin
Immortal
Immortal

I removed the attributes with xattr and put

fileMacos.timemachine.enable = "TRUE"

in the preferences file (without .txt).

It's config, not preferences.

0 Kudos
dizz
Contributor
Contributor

I've followed these instructions (removing the file attributes, adding the entry in the config file) but Time Machine is still not backing up the VM images. Any ideas why?

0 Kudos
khe91
Contributor
Contributor

Same here, my .vmwarevm files are only 200K in Time Machine (real size 3GB).

0 Kudos
todivefor
Enthusiast
Enthusiast

I can't get this to work. I added the line to the "config" file, and removed the exclude attribute from the existing files. I verified that the attribute was off. Once I start a VM, the exclude attribute is back on for all the files in the VM. I attached a screen shot of my "config" file. Any ideas?


Macbook Air M1, Monterey 12.6, Fusion Player Preview 22H2
0 Kudos
admin
Immortal
Immortal

I'm confused by your screenshot - the only time I've seen TextEdit (I assume that's what you're using) add the toolbar is when it thinks it's dealing with a rich text document. config needs to be plain text.

0 Kudos
WoodyZ
Immortal
Immortal

By default the .txt extension is hidden so would you copy and paste the following command into a Terminal (/Applications/Utilities/Terminal) then press Enter and make sure that config does not show as config.txt.

ls -l "/Users/$/Library/Preferences/VMware Fusion/"

0 Kudos
todivefor
Enthusiast
Enthusiast

etung, good catch. I was copying/pasting the command and saved as RTF. I re-editted it and saved as plain text, and that saved the problem.

Woody, thanks for your suggestion, I had gotten that part right.

Thank you to both.


Macbook Air M1, Monterey 12.6, Fusion Player Preview 22H2
0 Kudos
CentraSpike
Contributor
Contributor

I just applied this fix and now get the same issue - 200KB images in time machine (real size 8GB). Is there a solution ?

0 Kudos
MichaelMonschau
Contributor
Contributor

I have just spend a few more hours on this problem. I have been suffering with this for a very long time now.

Again, I followed all the instructions using xattr to remove the extended attributes, just leaving the attribute com.vmware.backupReenabled 1 on the files that had them.

I also made sure the VMWare preference file was up to date.

And I deleted all previous backups of my three virtual machines from the Time Machine Backup disks.

As I said I have three virtual machines, Ubuntu, Suse Linux and Windows XP. The Suse Linux and Windows XP v-machines were created with the first release version of VMWare Fusion, so they went through all the Fusion updates when they disabled updates, re-enabled them, etc. The Ubuntu v-machine was created with version 1.1.3 of Fusion, so after all the issues with backups.

After I cleared the attributes, deleted all previous backups, and did everything I can think of, only the Ubuntu virtual machine backs up completely. No doubt that is because it was created with Fusion 1.1.3. I believe that in one of the previous versions they did something that excludes specifically just one of the .vmdk files in vm package(you usually end up with two, the second one backs up ok) from the Time Machine backup. Some other setting or attribute somewhere else is stopping these specific files from being skipped during backups.

IF ANYONE FROM VMWARE IS READING THIS OR ANYONE ELSE WHO HAS THE ANSWER, PLEASE TELL ME WHAT THIS IS SO I CAN FIX MY VITAL BACKUPS.

I have invested hundreds of man-hours in setting up these two virtual machines. I am not kidding, we develop software and these are our Admin and build machines. If I cannot get these issues resolved I will have no choice but to dump VMWare and go back to using Parallels. I wonder if they can import VMWare virtual disks. I must have reliable backups of these machines and I cannot rely on staff to remember to back them up manually when required. It is too risky.

0 Kudos