meta data for this page
  •  

This is an old revision of the document!


ZFS

Creating ZFS dataset

zpool create INBOX /dev/loop0 /dev/loop1 /dev/loop2 /dev/loop3
# zpool list
NAME    SIZE  ALLOC   FREE    CAP  DEDUP  HEALTH  ALTROOT
INBOX   780M   448K   780M     0%  1.00x  ONLINE  -
# zpool status
  pool: INBOX
 state: ONLINE
 scrub: none requested
config:

        NAME        STATE     READ WRITE CKSUM
        INBOX       ONLINE       0     0     0
          loop0     ONLINE       0     0     0
          loop1     ONLINE       0     0     0
          loop2     ONLINE       0     0     0
          loop3     ONLINE       0     0     0

errors: No known data errors

Dataset “INBOX” is also automatically created based on zpool name “INBOX”. It is mounted as /INBOX

# zfs list
NAME    USED  AVAIL  REFER  MOUNTPOINT
INBOX   400K   748M   112K  /INBOX

Mount dataset

zfs mount INBOX

Create more datasets in pool

zfs create <pool name>/<data set name>

Add new block device (disc) to online pool

zpool add INBOX /dev/loop4

Deduplication and compression

Enable compression and dedupliaction in parent dataset (will be inherited by childs)

zfs set dedup=on INBOX
zfs set compression=on INBOX

But new attributed applies only to newly written data.

NAME    SIZE  ALLOC   FREE    CAP  DEDUP  HEALTH  ALTROOT
INBOX   975M   724M   251M    74%  1.00x  ONLINE  -

The same data copied again to dataset after compression enabled

NAME    SIZE  ALLOC   FREE    CAP  DEDUP  HEALTH  ALTROOT
INBOX   975M   563M   412M    57%  1.00x  ONLINE  -

zdb -S 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

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't work in ZFS.

References: