meta data for this page
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
zfs [2015/03/24 08:39] – niziak | linux:fs:zfs [2021/05/10 20:42] (current) – niziak | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== ZFS ====== | ====== ZFS ====== | ||
- | ===== Creating | + | [[https:// |
+ | |||
+ | [[https:// | ||
+ | |||
+ | Features: | ||
+ | * data pools (tanks) are abstraction aggregate block devices (simple, mirror, raidz, spares, etc) | ||
+ | * data set is created on data pool or another (parent) data set. | ||
+ | * whole data pool space is shared between | ||
+ | * compression | ||
+ | * block level deduplication (not usable for emails with attachment, where attachment are shifted to different offset) | ||
+ | |||
+ | OpenZFS2.0.0 (Dec 20) [[https:// | ||
+ | * Sequential resilver (rebuild only used by data portions) | ||
+ | * Persistent L2ARC cache (survives between reboots) | ||
+ | * ZSTD | ||
+ | * Redacted replication (replicate with some data excluded) | ||
+ | * FreeBSD and Linux unification | ||
+ | |||
+ | Proposed use case: | ||
+ | POOL created on encrypted LUKS block device. | ||
< | < | ||
+ | POOL | ||
+ | |-- /filer (quota) | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | | ||
+ | |-- /home (compression, | ||
+ | +-- /var (quota) | ||
+ | +- log (compression) | ||
+ | </ | ||
+ | |||
+ | ===== ZFS implementations ===== | ||
+ | |||
+ | ZFS-Fuse 0.7 is using old pool version 23, where [[http:// | ||
+ | [[http:// | ||
+ | |||
+ | |||
+ | |||
+ | ===== Creating ZFS dataset ===== | ||
+ | |||
+ | <code bash> | ||
zpool create INBOX /dev/loop0 /dev/loop1 /dev/loop2 /dev/loop3 | zpool create INBOX /dev/loop0 /dev/loop1 /dev/loop2 /dev/loop3 | ||
</ | </ | ||
- | < | + | < |
# zpool list | # zpool list | ||
NAME SIZE ALLOC | NAME SIZE ALLOC | ||
Line 13: | Line 54: | ||
</ | </ | ||
- | < | + | < |
# zpool status | # zpool status | ||
pool: INBOX | pool: INBOX | ||
Line 32: | Line 73: | ||
Dataset " | Dataset " | ||
- | < | + | < |
# zfs list | # zfs list | ||
NAME USED AVAIL REFER MOUNTPOINT | NAME USED AVAIL REFER MOUNTPOINT | ||
Line 61: | Line 102: | ||
zfs set dedup=on INBOX | zfs set dedup=on INBOX | ||
</ | </ | ||
+ | New attributed applies only to newly written data. | ||
Tests | Tests | ||
Line 126: | Line 168: | ||
dedup = 2.50, compress = 1.00, copies = 1.00, dedup * compress / copies = 2.50 | dedup = 2.50, compress = 1.00, copies = 1.00, dedup * compress / copies = 2.50 | ||
</ | </ | ||
+ | |||
+ | **So ZFS cannot match shifted data and make deduplication!** | ||
+ | |||
+ | Additional simple test. Two files: | ||
+ | |0|B1|0|B2|0|B3|0| | ||
+ | |0|B1|B2|B3| | ||
+ | Only beginning of both files |0|B1| was deduplicated (16MB saved) | ||
+ | |||
+ | ZFS provides block level deduplication based on block checksums which we got almost for free. | ||
+ | |||
===== Compression ===== | ===== Compression ===== | ||
Line 134: | Line 186: | ||
zfs set compression=on INBOX | zfs set compression=on INBOX | ||
</ | </ | ||
+ | Possible parameters for compression=on | off | lzjb | gzip | gzip-[1-9] | zle | ||
+ | New attributed applies only to newly written data. For test data I was using Maildir with some huge e-mails. | ||
- | But new attributed applies only to newly written data. | + | ^compression ^ logical size ^ physical size^ ratio | |
+ | |off | ||
+ | |on = lzjb | ||
+ | |gzip-1 | ||
+ | |gzip=gzip-6 | 702 MB | 359 MB | 1.95 | | ||
+ | |gzip-9 | ||
+ | |-- | ||
+ | |squashfs | ||
- | < | ||
- | NAME SIZE ALLOC | ||
- | INBOX | ||
- | </ | ||
- | |||
- | The same data copied again to dataset after compression enabled | ||
- | |||
- | < | ||
- | NAME SIZE ALLOC | ||
- | INBOX | ||
- | </ | ||
zdb -S INBOX | zdb -S INBOX | ||
- | |||
zdb -b INBOX | zdb -b INBOX | ||
- | ====== Tests: ====== | ||
- | Filesystem was tested with 648MiB of e-mail stored in Maildir format (lots of binary attachment encoded as BASE64). | ||
- | SquashFS=365MB vs ZFS=563MB | + | <code bash> |
- | + | zfs get compressratio | |
- | Deduplication: | + | </ |
- | + | ||
- | Deduplication on file level works on ZFS and SquashFS (the same folder copied again). | + | |
- | + | ||
- | Deduplication of 2 different 32MB blobs, with file concatenated from | 0 | blob1 | 0 | blob2 | 0 | blob1 | 0 | blob2 |0| | + | |
- | + | ||
- | Deduplication on the same attachment inside different email doesn' | + | |
- | ====== References: ====== | + | ===== References: ===== |
+ | [[http:// | ||
+ | [[https:// | ||
[[http:// | [[http:// |