Solved ZFS send takes more space than dataset itself

Hi,

I try to send dataset which size is presented below:
Code:
# zfs list zroot/some-dataset
zroot/some-dataset  1.28T   158G   860K  /some-dataset
When I do the snapshot and try to send it takes more than twice that space:
zfs send -nvR zroot/some-dataset@11:59-11-14-2020
out: total estimated size is 3.72T
This snapshot was created with '-r' flag.

I've got no idea why it's look like this. I'm using FreeBSD 11.0 so it may be the problem. Also I've got mirrors on my pool:
Code:
root@GKL-02VFSBI:~/ > zpool status
  pool: zroot
state: ONLINE
  scan: scrub repaired 0 in 8h30m with 0 errors on Mon Apr  9 17:37:06 2018
config:

        NAME          STATE     READ WRITE CKSUM
        zroot         ONLINE       0     0     0
          mirror-0    ONLINE       0     0     0
            ada3p3    ONLINE       0     0     0
            ada1p3    ONLINE       0     0     0
        logs
          mirror-1    ONLINE       0     0     0
            gpt/zil0  ONLINE       0     0     0
            gpt/zil1  ONLINE       0     0     0
        cache
          gpt/l2arc0  ONLINE       0     0     0
          gpt/l2arc1  ONLINE       0     0     0

Do you have any idea why stream is so big?
 
Last edited by a moderator:
I analyzed the issue at I'm little confused. So I've got snapshot which 'zfs list' and 'zfs get...' is below:
Code:
1. zfs list zroot/smaller-dataset@prod:
    NAME                                    USED  AVAIL  REFER  MOUNTPOINT
    zroot/smaller-dataset@prod      0      -  5.67G  -
2. zfs get referenced zroot/smaller-dataset@prod:
   NAME                                   PROPERTY    VALUE  SOURCE
   zroot/smaller-dataset@prod  referenced  5.67G  -
3. zfs get logicalreferenced 
    NAME                                   PROPERTY           VALUE   SOURCE
    zroot/smaller-dataset@prod  logicalreferenced  8.38G   -

The dataset size is smaller than snapshot:
Code:
4. zfs list zroot/smaller-dataset
    NAME                               USED  AVAIL  REFER
    zroot/smaller-dataset  5.67G   192G  5.67G
In 'zfs send' I got output: total estimated size is 8.39GB

After send and receive it on the other machine I can see:
Code:
1. zfs list zroot/smaller-dataset@prod:
    NAME                                    USED  AVAIL  REFER  MOUNTPOINT
    zroot/smaller-dataset@prod      0      -  8.77G  -
2. zfs get referenced zroot/smaller-dataset@prod:
   NAME                                   PROPERTY    VALUE  SOURCE
   zroot/smaller-dataset@prod  referenced  8.77G -
3. zfs get logicalreferenced 
    NAME                                   PROPERTY           VALUE   SOURCE
    zroot/smaller-dataset@prod  logicalreferenced  8.38G   -
4. zfs list zroot/smaller-dataset
    NAME                               USED  AVAIL  REFER
    zroot/smaller-dataset  8.77G  2.98T  8.77G

So it seems like after zfs send size of the snapshot and dataset itself got bigger. So I assume that when I send all data from one pull to another it is the same for all datasets. That's why the size is bigger by 2TB.
Is this normal or it's some kind of bug?
 
I don't necessarily see anything wrong here. Instead of sharing suspicions why not just tell us what exactly it is you're trying to do and what you've been expecting?

So you sent a snapshot and you expected less data, that's roughly it? I suggest another look at zfs(8) because the command you're using is generating a replication stream (-R) which implies that you're most likely sending more than just that single snapshot over, which could explain the filesize difference.
 
I don't necessarily see anything wrong here. Instead of sharing suspicions why not just tell us what exactly it is you're trying to do and what you've been expecting?

Sure, I just want to move data from zpool into zpool on the other machine in exactly the same format.
Zpool has two branches:
1. zroot/data/branch1/os: each dataset here has snapshot named „toclone”
2. zroot/data/branch2/host: each dataset here is clone of one of „toclone” snaps in branch1
So to send both branches to another zpool I just createt recursive snapshot on zroot/data (zfs snap -r zroot/data@tosend)
And tried to send it over command: zfs -vR zroot/data@tosend
But when I received it I need more than twice space needed in original zpool.
 
The title drew my attention. I thought I could contribute to it. But the contents seemed to be some unexpected.

I can only say that zfs send/receive consume as much system memory and bandwidth because of the processes involved. The processes include transmitting huge recursive datasets, (de)compression, checksums for error, etc.
 
Sorry for all it was my fault. The reason was obvious. On first zpool compression was enabled and in destination pool was disabled...
So the stream was uncompressed and that's why it was so big. I set compress property in root of destination zpool to lz4 and everything is fine.
 
Note there is a -c flag to zfs(8) send which will save you the CPU time decompressing / re-compressing (assuming both ends are set to the same compression) as well as reduce the size of data to be transferred.

There are also the logicalreferenced and logicalused properties you can look at to see that the quantity of user data referred to on both source and backup are the same.
 
Back
Top