zfs send but also turn on compression?

bexamous

[H]ard|Gawd
Joined
Dec 12, 2005
Messages
1,670
This isn't super critical, but I'm wondering how you're actually supposed to do this...

I've got a zfs file system on one hdd pool for esx. I want to move it to a new ssd pool.

Eg:
zfs snapshot lolol/esx@asdf
zfs send lolol/esx@asdf | zfs recv ssd/esx

But i want the new ssd/esx filesystem to have compression=lz4.

But I cannot do:
zfs create ssd/esx
zfs set compression=l4z ssd/esx
zfs send lolol/esx@asdf | zfs recv ssd/esx

Because:
cannot receive new filesystem stream: destination 'ssd/esx' exists
must specify -F to overwrite it

What would be correct way to do this?
 
Actually I see this:

# zfs get compression tank/data
NAME PROPERTY VALUE SOURCE
tank/data compression off default
# zfs snapshot tank/data@snap1
# zfs send -p tank/data@snap1 | zfs recv -o compression=on -d bpool
# zfs get -o all compression bpool/data
NAME PROPERTY VALUE RECEIVED SOURCE
bpool/data compression on off local

But recv doesn't have '-o' as an option. Maybe this isn't possible with ZoL? LOL I cannot log into work until I get my ESX VMs back up to check an actual Solaris install.
 
I think in fact it doesn't have '-o'. Can't you set compression=lz4 on the source filesystem before doing the send?
 
I was playing around with this as well, but I was changing my "copies" property because the receiving file system was a single disk external drive receiving a backup.

I do know that ZoL's zfs recv doesn't support property overriding via '-o' yet. It is being worked on for 0.6.5 (https://github.com/zfsonlinux/zfs/issues/1350)

You can work around this using property inheritance either from the pool's root zfs or an arbitrary zfs you create ahead of time.



For example say we have two pools test1 and test2

test1 contains a zfs named test1/testfs with a snapshot named snap1

If you want the backup to have different properites do this

Code:
zfs create -o copies=2 test2/backup 
zfs send test1/testfs@snap1 | zfs receive test2/backup/testfs@snap1

The received filesystem at test2/backup/testfs inherits your changed properties from test2/backup. Alternatively, I could have applied the property the pool's zfs to achieve the same thing.
 
Last edited:
Ah yeah inheritance works, I should have thought of that. In fact I'm not sure why I just don't leave on compression for pretty much everything. There seems to be negligible cpu overhead.

# zfs get compressratio ssd/esx
NAME PROPERTY VALUE SOURCE
ssd/esx compressratio 1.44x -


This is thin provisioned images too. Higher compression that I expected. I'm trying to fit all VM images on two mirrored 256GB SSDs so every bit helps.
 
Back
Top