Should I bother with compressed vhd?

Should I bother using compressed vhd for my images if I’m using Freenas as my storage with max compression already on the storage?

I did. I’m running the urbackup server in a FreeNAS 9.3 jail. At first, I didn’t use vhdz compressed images, since my main pool is using lz4 compression, but some experimentation showed that vhdz + LZ4 was using less physical blocks than vhd + LZ4.

Not sure I can still claim that compression is warranted, though. Unfortunately, I don’t have the original data. My oldest snapshot still has a mix of vhd and vhdz images, but I don’t see an easy way to determine the uncompressed size of a vhdz for a fair comparison. In that old snapshot, here’s the data on all the full image backups:

PC1/Image_C_150127-0231.vhd        88789440  130464196096  1469.366
PC1/Image_C_150328-0333.vhdz       74827631   76576597863  1023.373
PC1/Image_C_150527-0939.vhdz       75926581   77705955061  1023.435

PC2/Image_C_150127-0243.vhd        96241531  140937616896  1464.416
PC2/Image_C_150328-0344.vhdz      100601205  102981352645  1023.659
PC2/Image_C_150527-0615.vhdz      108005911  110560785757  1023.655

PC3/Image_C_150126-2323.vhd       114874781  191657188352  1668.401
PC3/Image_C_150328-0023.vhdz      108167889  110734719508  1023.730
PC3/Image_C_150527-0025.vhdz      111441920  114087366728  1023.738

The 2nd and 3rd columns are the disk block counts and file sizes (from ‘ls -ls’), and the last column is the file size divided by block count, for file bytes stored per 1K disk block. The large vhdz files are storing just a bit less than 1K file bytes per 1K block, so there’s apparently no extra compression happening there. But notice that for PC1, the 150127 vhd is using about 20% more blocks than the 150328 vhdz. On that machine, I would expect that the actual image sizes of those two backups would be similar, so the vhdz compression did actually have a big benefit. There’s a smaller 6% benefit for the same January-vs-March backups on PC3, but a 5% loss on PC2.

Without determining the actual uncompressed sizes of the vhdz files, I can’t be sure if those size differences are due to better compression of vhdz+lz4 over vhd+lz4, or a result of changing files in those images over the 2 months between them. The fact that the vhdz files are all storing about 1,023 bytes per disk block means that lz4 compression has no benefit over the vhdz compression. But (if I’m right that the January versus March images are roughly the same raw sizes) the block count improvements of vhdz over vhd likely means that the vhdz compression algorithm in urbackup is better than the lz4 one in FreeNAS.

The image compression uses zlib (miniZ actually but the same alogrithm). This compresses better than lzo at greater CPU cost. So if you use zlib on ZFS you should get about the same compression ratio.

I would use the ZFS compression as it makes handling the images easier e.g. if you want to mount one on Windows. And ZFS does not try to recompress it again.