Currently UrBackup is storing images of volumes as VHD (Virtual HardDisk) files. In UrBackup Server 1.4 the VHD file format was augmented with a custom compression. This combination gives following advantages over storing images as „raw“ files:
- Only used parts of the volumes are stored to the VHD files (sparse image)
- If the compression is enabled, the volume data is compressed
- Incremental image backups: A VHD file can reference another VHD file, so unchanged data does not have to be stored twice (differential image)
All this can be implemented with btrfs. Volume images can then be stored as raw files:
- There is a Linux system call to „punch holes“ into a file. Btrfs supports this. Using hole punching only the parts of the raw image file which are used are stored
- Btrfs has a compression feature
- You can copy a file on btrfs without copying the data the files contain. You can do this in a Linux console via „cp –reflink=always“. A file copied this way only adds another reference to the file data. The file only becomes a “real” copy at changed parts of the file (Copy on Write).
An incremental image backup can then be done like this: Create reflink of the last image backup, change the parts in the image file that have changed since the last image backup and then punch holes into the file to remove unused parts.
As you can see, this moves the implementation of compression, sparse image support and differential image support into btrfs, which is a good thing, because btrfs is starting to get widespread adoption.
The implementation using btrfs has several advantages:
- The volumes are stored as raw files, which makes inter-operation easier. For example you can directly map the file to a Linux volume device, which makes the file look like a volume on a hard drive.
- UrBackup can delete any image in the incremental backup chain and btrfs takes care of cleaning up the unused blocks. This makes running infinite incremental image backups viable. After the initial full backup you only need to make incremental image backups
The only disadvantage I saw till now is that UrBackup cannot accurately display the size of incremental image backups anymore. It always shows the size as if it was an uncompressed full image.
This new image file format will be available in UrBackup 1.5 if UrBackup is configured such that it uses btrfs.