Veeam backups occupying too much space

Hey. I’m using Veeam B&R 12 to backup few Windows VMs to various backup repositories. Today I added TrueNAS as a repo and did some tests.

What I got is backups taking almost twice as much space as Veeam says it transferred, which makes no sense to me.

I’m using a 2 disk mirror for backup pool, encrypted and uncompressed. When I turned compression on (zstd) the numbers almost halved, so in that regard they became somewhat normal. But what is not normal is that there is 2x compression being done on files that Veeam already compresses, so something is still weird.
I also tried with unencrypted pool, with different recordsizes, etc., no difference.

I have the same backups being done on Proxmox dataset, and there is no problem there, numbers look fine and completely different than on TrueNAS dataset.

So if anyone got any ideas what might be going on… do tell.

TrueNAS SCALE version: 24.10-RC.2
Also developer mode is enabled, so Veeam Agent could be installed.

Are you taking snapshot on that pool/datasets?
The first thing i would check Is that, if the snapshots are taking the extra space

1 Like

No, no snapshots at all. I’m talking about the file sizes.
I can dig up exact outputs.

This is from when zstd compression was enabled (when compression is disabled the size came out as 517G)

root@truenas[/mnt/hdd/veeambackups/Test1]# ll -lsh
total 274G
25K drwxr-xr-x 2 veeam_user    5 Oct 20 10:33 ./
8.5K drwxr-xr-x 4 veeam_user    3 Oct 20 09:26 ../
4.5K -rw-r--r-- 1 root        209 Oct 20 10:33 .veeam.1.lock
274G -rw-r--r-- 1 veeam_user 517G Oct 20 10:33 EDUS-VSRV-DC.6146a784-57bd-4434-9333-1dd2e141D2024-10-20T092624_3CC1.vbk
8.5K -rw-r--r-- 1 veeam_user  17K Oct 20 10:33 EDUS-VSRV-DC_4BD39.vbm
root@truenas[/mnt/hdd/veeambackups/Test1]# zfs get all hdd/veeambackups | grep compress
hdd/veeambackups  compressratio            1.88x                    -
hdd/veeambackups  compression              zstd                     inherited from hdd
hdd/veeambackups  refcompressratio         1.88x                    -

And this is same VM from Proxmox (backup from yesterday):

270G -rw-r--r-- 1 veeam veeam 300G Oct 19 21:40 EDUS-VSRV-DC.6146a784-57bd-4434-9333-1dd2e141D2024-10-19T213924_A4E6.vbk

There is no way there can be 517G of data because VM itself has 400G drive, and has 300 something GB data on it. Also Veeam compresses files already. In the first example it reports ‘Transferred: 267.8 GB’. So something is off.

Looks like your data compresses nicely.
Note that leftmost column shows 274G, which is close to what Proxmox reports (270G).

Veeam compresses data being transferred, which also aligns with your reported transfer amount.

Now, why your VM is actually 517G when the VM is set to use a 400G drive, I don’t know.

zstd is good, but not THAT good. Especially not on data that is already compressed. Also, as you said yourself, it doesn’t explain where 517G came from.

Can be related to the many problem folks are reporting with the new zfs version in EE? I missed that part before

Dataset or zvol?

From lzo to zstd? Or from nothing to zstd?

Dataset.

From nothing.

The point is if compression=off then a ~300 GB Windows Server gets backed up by Veeam which compresses the backup file to ~270 GB and transfers it to TrueNAS and on TrueNAS ls -l shows a 517 GB file.

If compression is on it looks like at least file size is somewhat normal, but it still doesn’t explain where 200% compression on 517 GB file came from. Or more precisely where did 517 GB itself come from.

Dataset.

I suspected zvols.

Just a heads up, I don’t know how Veeam writes data and these are just wild guess on my part.

Last time I used it, you were able to set how big the blocks should be.
Maybe the default is some very small number that creates a lot of metadata overhead?

That is what I suspected. Because my guess would be that even with lzo you would achieve similar compression results. Why that?
Well this is just a wild guess, but maybe Veeam does some strange writing or maybe there is a lot of metadata overhead or something.

I have read that you should never ever have compression disabled. Even for none compressable data like zip files, you still gain the metadata compression and lzo costs basically nothing.

Or sometimes it is just that ZFS is funky when it comes to pool usage and stuff like that.

ZFS has to create logical blocks of certain sizes. If your data is for example 65k, ZFS can’t use a 64k block and instead has to use a 128k block with 63k of zero padding. That takes up 128k + metadata. Compression can resolve this, because a zero padding compresses down to basically nothing, so it can store the 128k logical block in something like 17x4K = 68K physical blocks.
If your actual data is also compressible that’s even less blocks used.

This is of course a toy example, but a basically perfect 2:1 compression ratio on already compressed data looks like it might have something to do with this.

Edit: Note that the configured “record size” is a maximum. If the data is under half the size, a smaller block is used automatically. If it’s larger, two, three, etc. blocks are used, with the last one being zero padded. So a filesystem with 1M record size and 1.1M data would basically have the same issue where then 2x1M logical blocks are created and again compression has to be used.
Using smaller block sizes (especially for backups) also isn’t really advisable, as it leads to both excessive fragmentation and a lot more metadata usage

1 Like

Perfect explanation @Momi_V!

In these settings, you can set the file sizes under “advanced…” @zbe


Not sure what the default for your SMB share is nowadays (it is a SMB share, right?), but according to this, it could be 512k.

Question for @Momi_V:
Assuming it is 512k. Does Veeam write 512k, which is four 128k logical blocks, but than has to add metadata and since ZFS does not allow for different sized recordsizes within the same file, there is anohter 128k block needed? So to store 512k from Veeam, it would take up 640k if compression is not enabled?

I feel like we’re going in circles.

It’s not SMB share, it’s direct storage, with Veeam Agent. And recordsize and Veeam block sizes are both set to 1 MB. And I tested different values, doesn’t matter.

And again: I have Proxmox with zfs 2.2.6 which behaves totally different – normal, I’d say.

Could you zfs get all <pool/dataset> on both the Proxmox and TrueNAS pool?
Then we’d have an idea what might cause those changes. There’s conflicting information about whether PvE uses compression by default.

Also: Veam Block size of 1M - compression could very well come out to something like a worst case of having to store more than 512k, but less than 600k. That would cause the exact symptoms you are experiencing: A LOT of extra space used, but compression solves that even if the data should already be compressed.

Edit: testing different values doesn’t help, because the problem is the ratio between the application block sizes and what ZFS can work with.
If your Veeam compression comes out to 0.6 and uses a 2^n block size then no matter what record size you set ZFS to it will waste that space unless it’s significantly smaller (by like 4x or more) than the Veeam block size. And remember: changes to record size only affect newly written data.

2 Likes

Sure.
PVE:

NAME         PROPERTY              VALUE                     SOURCE
hpool/veeam  type                  filesystem                -
hpool/veeam  creation              Sun Aug  4 22:19 2024     -
hpool/veeam  used                  4.59T                     -
hpool/veeam  available             390G                      -
hpool/veeam  referenced            4.49T                     -
hpool/veeam  compressratio         1.10x                     -
hpool/veeam  mounted               yes                       -
hpool/veeam  quota                 none                      default
hpool/veeam  reservation           none                      default
hpool/veeam  recordsize            128K                      default
hpool/veeam  mountpoint            /hpool/veeam              default
hpool/veeam  sharenfs              off                       default
hpool/veeam  checksum              on                        default
hpool/veeam  compression           zstd                      inherited from hpool
hpool/veeam  atime                 on                        inherited from hpool
hpool/veeam  devices               on                        default
hpool/veeam  exec                  on                        default
hpool/veeam  setuid                on                        default
hpool/veeam  readonly              off                       default
hpool/veeam  zoned                 off                       default
hpool/veeam  snapdir               visible                   inherited from hpool
hpool/veeam  aclmode               discard                   default
hpool/veeam  aclinherit            restricted                default
hpool/veeam  createtxg             8710219                   -
hpool/veeam  canmount              on                        default
hpool/veeam  xattr                 on                        default
hpool/veeam  copies                1                         default
hpool/veeam  version               5                         -
hpool/veeam  utf8only              off                       -
hpool/veeam  normalization         none                      -
hpool/veeam  casesensitivity       sensitive                 -
hpool/veeam  vscan                 off                       default
hpool/veeam  nbmand                off                       default
hpool/veeam  sharesmb              off                       default
hpool/veeam  refquota              none                      default
hpool/veeam  refreservation        none                      default
hpool/veeam  guid                  16792976793728404163      -
hpool/veeam  primarycache          all                       default
hpool/veeam  secondarycache        all                       default
hpool/veeam  usedbysnapshots       97.4G                     -
hpool/veeam  usedbydataset         4.49T                     -
hpool/veeam  usedbychildren        0B                        -
hpool/veeam  usedbyrefreservation  0B                        -
hpool/veeam  logbias               latency                   default
hpool/veeam  objsetid              3558                      -
hpool/veeam  dedup                 off                       default
hpool/veeam  mlslabel              none                      default
hpool/veeam  sync                  standard                  default
hpool/veeam  dnodesize             legacy                    default
hpool/veeam  refcompressratio      1.10x                     -
hpool/veeam  written               0                         -
hpool/veeam  logicalused           5.09T                     -
hpool/veeam  logicalreferenced     4.98T                     -
hpool/veeam  volmode               default                   default
hpool/veeam  filesystem_limit      none                      default
hpool/veeam  snapshot_limit        none                      default
hpool/veeam  filesystem_count      none                      default
hpool/veeam  snapshot_count        none                      default
hpool/veeam  snapdev               hidden                    inherited from hpool
hpool/veeam  acltype               off                       default
hpool/veeam  context               none                      default
hpool/veeam  fscontext             none                      default
hpool/veeam  defcontext            none                      default
hpool/veeam  rootcontext           none                      default
hpool/veeam  relatime              on                        inherited from hpool
hpool/veeam  redundant_metadata    all                       default
hpool/veeam  overlay               on                        default
hpool/veeam  encryption            off                       default
hpool/veeam  keylocation           none                      default
hpool/veeam  keyformat             none                      default
hpool/veeam  pbkdf2iters           0                         default
hpool/veeam  special_small_blocks  0                         default
hpool/veeam  snapshots_changed     Tue Oct 22  2:15:02 2024  -
hpool/veeam  prefetch              all                       default

TrueNAS:

NAME              PROPERTY                 VALUE                    SOURCE
hdd/veeambackups  type                     filesystem               -
hdd/veeambackups  creation                 Sun Oct 20 18:52 2024    -
hdd/veeambackups  used                     757G                     -
hdd/veeambackups  available                1.02T                    -
hdd/veeambackups  referenced               757G                     -
hdd/veeambackups  compressratio            1.73x                    -
hdd/veeambackups  mounted                  yes                      -
hdd/veeambackups  quota                    none                     default
hdd/veeambackups  reservation              none                     default
hdd/veeambackups  recordsize               1M                       local
hdd/veeambackups  mountpoint               /mnt/hdd/veeambackups    default
hdd/veeambackups  sharenfs                 off                      default
hdd/veeambackups  checksum                 on                       inherited from hdd
hdd/veeambackups  compression              zstd                     inherited from hdd
hdd/veeambackups  atime                    off                      inherited from hdd
hdd/veeambackups  devices                  on                       default
hdd/veeambackups  exec                     on                       inherited from hdd
hdd/veeambackups  setuid                   on                       default
hdd/veeambackups  readonly                 off                      inherited from hdd
hdd/veeambackups  zoned                    off                      default
hdd/veeambackups  snapdir                  visible                  local
hdd/veeambackups  aclmode                  discard                  inherited from hdd
hdd/veeambackups  aclinherit               passthrough              inherited from hdd
hdd/veeambackups  createtxg                72                       -
hdd/veeambackups  canmount                 on                       default
hdd/veeambackups  xattr                    sa                       local
hdd/veeambackups  copies                   1                        local
hdd/veeambackups  version                  5                        -
hdd/veeambackups  utf8only                 off                      -
hdd/veeambackups  normalization            none                     -
hdd/veeambackups  casesensitivity          sensitive                -
hdd/veeambackups  vscan                    off                      default
hdd/veeambackups  nbmand                   off                      default
hdd/veeambackups  sharesmb                 off                      default
hdd/veeambackups  refquota                 none                     default
hdd/veeambackups  refreservation           none                     default
hdd/veeambackups  guid                     16143137184432811085     -
hdd/veeambackups  primarycache             all                      default
hdd/veeambackups  secondarycache           all                      default
hdd/veeambackups  usedbysnapshots          0B                       -
hdd/veeambackups  usedbydataset            757G                     -
hdd/veeambackups  usedbychildren           0B                       -
hdd/veeambackups  usedbyrefreservation     0B                       -
hdd/veeambackups  logbias                  latency                  default
hdd/veeambackups  objsetid                 388                      -
hdd/veeambackups  dedup                    off                      inherited from hdd
hdd/veeambackups  mlslabel                 none                     default
hdd/veeambackups  sync                     standard                 inherited from hdd
hdd/veeambackups  dnodesize                legacy                   default
hdd/veeambackups  refcompressratio         1.73x                    -
hdd/veeambackups  written                  757G                     -
hdd/veeambackups  logicalused              1.28T                    -
hdd/veeambackups  logicalreferenced        1.28T                    -
hdd/veeambackups  volmode                  default                  default
hdd/veeambackups  filesystem_limit         none                     default
hdd/veeambackups  snapshot_limit           none                     default
hdd/veeambackups  filesystem_count         none                     default
hdd/veeambackups  snapshot_count           none                     default
hdd/veeambackups  snapdev                  hidden                   inherited from hdd
hdd/veeambackups  acltype                  posix                    inherited from hdd
hdd/veeambackups  context                  none                     default
hdd/veeambackups  fscontext                none                     default
hdd/veeambackups  defcontext               none                     default
hdd/veeambackups  rootcontext              none                     default
hdd/veeambackups  relatime                 on                       default
hdd/veeambackups  redundant_metadata       all                      default
hdd/veeambackups  overlay                  on                       default
hdd/veeambackups  encryption               aes-256-gcm              -
hdd/veeambackups  keylocation              none                     default
hdd/veeambackups  keyformat                hex                      -
hdd/veeambackups  pbkdf2iters              0                        default
hdd/veeambackups  encryptionroot           hdd                      -
hdd/veeambackups  keystatus                available                -
hdd/veeambackups  special_small_blocks     0                        inherited from hdd
hdd/veeambackups  prefetch                 all                      default
hdd/veeambackups  org.freenas:description                           local
hdd/veeambackups  org.truenas:managedby    xx.xx.xx.xxx            local

Again, it is same result with encryption=off and/or recordsize=128K.

TrueNAS data is from a full backup of 4 VMs + 1 incremental.
Full backup as viewed from Veeam:

Success 4 Start time 00:00:04 Total size 1,5 TB Backup size 1,3 TB
Warning 0 End time 03:19:26 Data read 822,3 GB Dedupe 1,8x
Error 0 Duration 3:19:22 Transferred 709,5 GB Compression 0,6x

And incremental one, day after:

Success 4 Start time 00:00:20 Total size 1,5 TB Backup size 12,8 GB
Warning 0 End time 00:04:38 Data read 12,1 GB Dedupe 1,1x
Error 0 Duration 0:04:18 Transferred 5,6 GB Compression 0,8x