Skip to content

antony@notes:~/data-platform$ cat "OpenZFS.md"

OpenZFS

2024-10-20· data-platform

OpenZFS

OpenZFS 是 Sun Microsystems 這家公司開發的,

如何安裝在 Alpine Linux

$ sudo apk add zfs 
$ sudo nano /etc/local.d/rc.local.start
.......
modprobe tun
modprobe fuse
mount --make-rshared /
modprobe br_netfilter
modprobe ip_tables
modprobe zfs

echo "$[1024*1024*1024 - 1]" > /sys/module/zfs/parameters/zfs_arc_min
echo "$[1024*1024*1024]" > /sys/module/zfs/parameters/zfs_arc_max

Limit ZFS Memory Usage
ZFS uses 50 % of the host memory for the Adaptive Replacement Cache (ARC) by default. For new installations starting with Proxmox VE 8.1, the ARC usage limit will be set to 10 % of the installed physical memory, clamped to a maximum of 16 GiB. This value is written to /etc/modprobe.d/zfs.conf.

Allocating enough memory for the ARC is crucial for IO performance, so reduce it with caution. As a general rule of thumb, allocate at least 2 GiB Base + 1 GiB/TiB-Storage. For example, if you have a pool with 8 TiB of available storage space then you should use 10 GiB of memory for the ARC.

ZFS also enforces a minimum value of 64 MiB.


$ sudo rc-update add zfs-import default
$ sudo rc-update add zfs-mount default

# To create a striped pool. The newly created pool is mounted at /new-pool. You can select a different mount point using the -m option:
$ sudo zpool create -m /opt/zfs zfs-pool /dev/sdb /dev/sdc

$ sudo reboot

$ df -h /opt/zfs
Filesystem      Size  Used Avail Use% Mounted on
zfs-pool        1.6T  128K  1.6T   1% /opt/zfs