meta data for this page
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
zfs [2015/03/23 14:31] – niziak | linux:fs:zfs [2015/07/01 07:43] – niziak | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== ZFS ====== | ====== ZFS ====== | ||
- | ===== Creating ZFS dataset | + | [[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) | ||
+ | |||
+ | 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 45: | ||
</ | </ | ||
- | < | + | < |
# zpool status | # zpool status | ||
pool: INBOX | pool: INBOX | ||
Line 32: | Line 64: | ||
Dataset " | Dataset " | ||
- | < | + | < |
# zfs list | # zfs list | ||
NAME USED AVAIL REFER MOUNTPOINT | NAME USED AVAIL REFER MOUNTPOINT | ||
Line 55: | Line 87: | ||
zpool add INBOX /dev/loop4 | zpool add INBOX /dev/loop4 | ||
</ | </ | ||
- | ===== Deduplication and compression ===== | ||
- | Enable compression and dedupliaction in parent dataset (will be inherited by childs) | + | ===== Deduplication ===== |
< | < | ||
zfs set dedup=on INBOX | zfs set dedup=on INBOX | ||
- | zfs set compression=on INBOX | ||
</ | </ | ||
+ | New attributed applies only to newly written data. | ||
- | But new attributed applies only to newly written | + | Tests |
+ | For test I was using 3 files 16MB each of random | ||
+ | Above 3 files takes 38,6M on disc: | ||
+ | < | ||
+ | # zdb -S INBOX | ||
+ | Simulated DDT histogram: | ||
+ | bucket | ||
+ | ______ | ||
+ | refcnt | ||
+ | ------ | ||
+ | | ||
+ | | ||
+ | |||
+ | dedup = 1.00, compress = 1.00, copies = 1.00, dedup * compress / copies = 1.00 | ||
+ | </ | ||
+ | |||
+ | Additionaly one big file with content B1|B2|B3 was added to filesystem: | ||
< | < | ||
- | NAME SIZE ALLOC | + | # zdb -S INBOX |
- | INBOX | + | Simulated DDT histogram: |
+ | |||
+ | bucket | ||
+ | ______ | ||
+ | refcnt | ||
+ | ------ | ||
+ | | ||
+ | | ||
+ | |||
+ | dedup = 2.00, compress = 1.00, copies = 1.00, dedup * compress / copies = 2.00 | ||
</ | </ | ||
- | The same data copied again to dataset after compression enabled | + | Additionaly one big file with content B1|B2|B3|B1|B2|B3 was added to filesystem: |
+ | < | ||
+ | # zdb -S INBOX | ||
+ | Simulated DDT histogram: | ||
+ | |||
+ | bucket | ||
+ | ______ | ||
+ | refcnt | ||
+ | ------ | ||
+ | | ||
+ | | ||
+ | |||
+ | dedup = 4.00, compress = 1.00, copies = 1.00, dedup * compress / copies = 4.00 | ||
+ | |||
+ | </ | ||
+ | Next, new file with content 0|B1|B2|B3 (one dummy byte plus B1|B2|B3) was added: | ||
< | < | ||
- | NAME SIZE ALLOC | + | # zdb -S INBOX |
- | INBOX | + | Simulated DDT histogram: |
+ | |||
+ | bucket | ||
+ | ______ | ||
+ | refcnt | ||
+ | ------ | ||
+ | | ||
+ | | ||
+ | Total 769 | ||
+ | |||
+ | dedup = 2.50, compress = 1.00, copies = 1.00, dedup * compress / copies = 2.50 | ||
</ | </ | ||
- | ====== Summary: ====== | + | **So ZFS cannot match shifted data and make deduplication!** |
- | Filesystem | + | Additional simple test. Two files: |
+ | |0|B1|0|B2|0|B3|0| | ||
+ | |0|B1|B2|B3| | ||
+ | Only beginning of both files |0|B1| | ||
- | SquashFS=365MB vs ZFS=563MB | + | ZFS provides block level deduplication based on block checksums which we got almost for free. |
- | Deduplication on file levels works on ZFS and SquashFS (the same folder copied again). | ||
- | ====== References: ====== | + | ===== Compression ===== |
+ | |||
+ | Enable compression and dedupliaction in parent dataset (will be inherited by childs) | ||
+ | |||
+ | < | ||
+ | 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. | ||
+ | |||
+ | ^compression ^ logical size ^ physical size^ ratio | | ||
+ | |off | ||
+ | |on = lzjb | ||
+ | |gzip-1 | ||
+ | |gzip=gzip-6 | 702 MB | 359 MB | 1.95 | | ||
+ | |gzip-9 | ||
+ | |-- | ||
+ | |squashfs | ||
+ | |||
+ | |||
+ | |||
+ | zdb -S INBOX | ||
+ | zdb -b INBOX | ||
+ | |||
+ | |||
+ | ===== References: ===== | ||
+ | [[http:// | ||
+ | [[https:// | ||
[[http:// | [[http:// | ||
+ | |||
+ | [[http:// | ||
+ | |||
+ | [[http:// | ||