This will create a 100 MB file on /tmp then a zpool and zfs file system on it with both compression and deduplication enabled:
cd /tmp dd if=/dev/zero of=zfile bs=1024k count=100 zpool create -O dedup=on -O compress=on filepool /tmp/zfile
The file system is mounted on /filepool and unlike squashfs is writable.
Just copy your files and directories in it and use zpool list filepool
to get usage (ALLOC/FREE/CAP) and deduplication ratio (DEDUP).
eg.
# zpool list filepool NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT filepool 95,5M 1,50M 94,0M 1% 2.99x ONLINE -
To see the compression ratio, use the zfs get compressratio
command:
# zfs get compressratio filepool NAME PROPERTY VALUE SOURCE filepool compressratio 1.37x -
You can experiment with the various compression algorithms by specifying a non default one while creating the pool, eg.:
zpool create -O dedup=on -O compress=gzip-9 filepool /tmp/zfile