ZFS Archives - F1-CONSULT https://www.f1-consult.com/blog/linux/storage/zfs/ Our Network For Your Network Tue, 25 Jan 2022 14:59:00 +0000 en-US hourly 1 https://wordpress.org/?v=7.1.5 https://www.f1-consult.com/wp-content/uploads/2018/01/cropped-F1-CONSULT-favicon-32x32.png ZFS Archives - F1-CONSULT https://www.f1-consult.com/blog/linux/storage/zfs/ 32 32 ZFS – CENTOS Downgrade https://www.f1-consult.com/linux/storage/zfs/downgrade/ Thu, 13 Sep 2018 23:07:47 +0000 https://www.f1-consult.com/?p=3954 ZFS – Downgrade Commands for Centos: To do the downgrade/re-install dance: [crayon-6b043652634fc518450703/] [crayon-6b04365263507236717124/] [crayon-6b0436526350c958146218/]

The post ZFS – CENTOS Downgrade appeared first on F1-CONSULT.

]]>
ZFS – Downgrade Commands for Centos:

To do the downgrade/re-install dance:

sudo yum remove zfs zfs-kmod spl spl-kmod libzfs2 libnvpair1 libuutil1 libzpool2 zfs-release
sudo yum install http://download.zfsonlinux.org/epel/zfs-release.el7_6.noarch.rpm

nano /etc/yum.repos.d/zfs.repo
[zfs]
enabled=0

[zfs-kmod]
enabled=1

sudo yum search zfs* --show-duplicates
sudo yum list --showduplicates zfs
sudo yum install kmod-spl-0.7.9-1.el7_5.x86_64 kmod-zfs-0.7.9-1.el7_5.x86_64

The post ZFS – CENTOS Downgrade appeared first on F1-CONSULT.

]]>
ZFS – Tuning https://www.f1-consult.com/linux/storage/zfs/tuning/ Thu, 13 Sep 2018 16:59:00 +0000 https://www.f1-consult.com/?p=3947 ZFS tuning for SAS3 Storage Tank [crayon-6b043652639b0800555108/] ZFS tuning for SAS3 ALL SSD + nVME Storage Tank [crayon-6b043652639ba193249388/] Some more good advice: SvennD ZFS-Discuss

The post ZFS – Tuning appeared first on F1-CONSULT.

]]>
ZFS tuning for SAS3 Storage Tank

####
# ZFS tuning
###
echo > /etc/modprobe.d/zfs.conf
echo -e "\
# ---------------- BEGIN ----------------  \r
# ZFS tuning for SAS3 12GE Storage Tank \r
# tank-a  Total Memory: 327680 MB
# tank-b  Total Memory: 393216 MB
# total arc size limited to 90% of free -m - factor is 1024  \r
# zfs_arc_max={{ '%d' | format(memtotal_mb*1024*1024*0.9) }} \r
options zfs zfs_arc_min=262144000000 \r
options zfs zfs_arc_max=314572800000 \r
options zfs zfs_compressed_arc_enabled=0 \r
###\r
# txg timeout \r
options zfs zfs_txg_timeout=5 \r
###\r
# disable prefetch \r
options zfs zfs_prefetch_disable=1 \r
###\r
# tune l2arc \r
# max write speed to l2arc \r
# default : 8 * 1024 * 1024 \r
# setting here : 500 * 1024 * 1024 \r
options zfs l2arc_write_max=524288000 \r
options zfs l2arc_write_boost=524288000 \r
options zfs l2arc_noprefetch=0 \r
options zfs l2arc_headroom=24 \r
###\r
# dirty pages \r
options zfs zfs_dirty_data_max_percent=40 \r
###\r
# sync zfs_vdev_* \r
# increase them so scrub/resilver is more quickly at the cost of other work \r
options zfs zfs_vdev_scrub_min_active=24 \r
options zfs zfs_vdev_scrub_max_active=64 \r
# sync write \r
options zfs zfs_vdev_sync_write_min_active=8 \r
options zfs zfs_vdev_sync_write_max_active=32 \r
# sync reads (normal) \r
options zfs zfs_vdev_sync_read_min_active=8 \r
options zfs zfs_vdev_sync_read_max_active=32 \r
# async reads : prefetcher \r
options zfs zfs_vdev_async_read_min_active=8 \r
options zfs zfs_vdev_async_read_max_active=32 \r
# async write : bulk writes \r
options zfs zfs_vdev_async_write_min_active=8 \r
options zfs zfs_vdev_async_write_max_active=32 \r
###\r
# scrub \r
options zfs zfs_top_maxinflight=320 \r
options zfs zfs_resilver_delay=0 \r
options zfs zfs_scrub_delay=0 \r
options zfs zfs_resilver_min_time_ms=5000 \r
###\r
# scheduler \r
options zfs zfs_vdev_scheduler=deadline \r
###\r
# cpu limits \r
options zfs zio_taskq_batch_pct=85 \r
options zfs zfs_sync_taskq_batch_pct=85 \r
###\r
# history \r
options zfs zfs_read_history=100 \r
options zfs zfs_read_history_hits=100 \r
options zfs zfs_txg_history=10 \r
###\r
# other tuning\r
options zfs zfs_nocacheflush=1 \r
###\r
# --------------- END ------------------" \
> /etc/modprobe.d/zfs.conf
cat /etc/modprobe.d/zfs.conf
/sbin/modprobe zfs

cat /proc/spl/kstat/zfs/arcstats

ZFS tuning for SAS3 ALL SSD + nVME Storage Tank

####
# ZFS tuning
# https://www.svennd.be/tuning-of-zfs-module/
###
echo > /etc/modprobe.d/zfs.conf
echo -e "\
# ---------------- BEGIN ----------------  \r
# ZFS tuning for SAS3 ALL SSD + nVME Storage Tank \r
# total arc size limited to 90% of free -m - factor is 1024  \r
# zfs_arc_max={{ '%d' | format(memtotal_mb*1024*1024*0.9) }} \r
options zfs zfs_arc_min=262144000000 \r
options zfs zfs_arc_max=283115520000 \r
options zfs zfs_compressed_arc_enabled=0 \r
###\r
# txg timeout \r
options zfs zfs_txg_timeout=5 \r
###\r
# disable prefetch \r
options zfs zfs_prefetch_disable=1 \r
###\r
# tune l2arc \r
# max write speed to l2arc \r
# default : 8 * 1024 * 1024 \r
# setting here : 500 * 1024 * 1024 \r
options zfs l2arc_write_max=524288000 \r
options zfs l2arc_write_boost=524288000 \r
options zfs l2arc_noprefetch=0 \r
options zfs l2arc_headroom=24 \r
###\r
# dirty pages \r
options zfs zfs_dirty_data_max_percent=40 \r
###\r
# sync zfs_vdev_* \r
# increase them so scrub/resilver is more quickly at the cost of other work \r
options zfs zfs_vdev_scrub_min_active=24 \r
options zfs zfs_vdev_scrub_max_active=64 \r
# sync write \r
options zfs zfs_vdev_sync_write_min_active=8 \r
options zfs zfs_vdev_sync_write_max_active=32 \r
# sync reads (normal) \r
options zfs zfs_vdev_sync_read_min_active=8 \r
options zfs zfs_vdev_sync_read_max_active=32 \r
# async reads : prefetcher \r
options zfs zfs_vdev_async_read_min_active=8 \r
options zfs zfs_vdev_async_read_max_active=32 \r
# async write : bulk writes \r
options zfs zfs_vdev_async_write_min_active=8 \r
options zfs zfs_vdev_async_write_max_active=32 \r
###\r
# scrub \r
options zfs zfs_top_maxinflight=320 \r
options zfs zfs_resilver_delay=0 \r
options zfs zfs_scrub_delay=0 \r
options zfs zfs_resilver_min_time_ms=5000 \r
###\r
# scheduler \r
options zfs zfs_vdev_scheduler=deadline \r
###\r
# cpu limits \r
options zfs zio_taskq_batch_pct=85 \r
options zfs zfs_sync_taskq_batch_pct=85 \r
###\r
# history \r
options zfs zfs_read_history=100 \r
options zfs zfs_read_history_hits=100 \r
options zfs zfs_txg_history=10 \r
###\r
# other tuning\r
options zfs zfs_nocacheflush=1 \r
###\r
# --------------- END ------------------" \
> /etc/modprobe.d/zfs.conf
cat /etc/modprobe.d/zfs.conf
/sbin/modprobe zfs

cat /proc/spl/kstat/zfs/arcstats

Some more good advice:

SvennD

ZFS-Discuss

The post ZFS – Tuning appeared first on F1-CONSULT.

]]>
ZFS – SNMP https://www.f1-consult.com/linux/storage/zfs/snmp/ Wed, 12 Sep 2018 14:19:51 +0000 https://www.f1-consult.com/?p=3931 ZFS – SNMP Extend Commands: [crayon-6b04365263bfc452347303/] LibreNMS: https://community.librenms.org/t/zfs-support/1839 https://docs.librenms.org/#Extensions/Applications/#zfs

The post ZFS – SNMP appeared first on F1-CONSULT.

]]>
ZFS – SNMP Extend Commands:

#Zpool Usage
extend .1.3.6.1.4.1.2021.88 zpool_name /bin/bash -c "sudo zpool list -H -o name"
extend .1.3.6.1.4.1.2021.88 zpool_snap /bin/bash -c "sudo zpool list -Ho name|for strzpool in `xargs`;do sudo zfs get -rHp -o value usedbysnapshots $strzpool|awk -F: '{sum+=$1} END{print sum}';done"
extend .1.3.6.1.4.1.2021.88 zpool_used /bin/bash -c "sudo zpool list -Ho name|xargs sudo zfs get -Hp -o value used"
extend .1.3.6.1.4.1.2021.88 zpool_data_used /bin/bash -c "sudo zpool list -Ho name|for strzpool in `xargs`;do snap=`sudo zfs get -rHp -o value usedbysnapshots $strzpool|awk -F: '{sum+=$1} END{print sum}'`;pool=`sudo zfs get -Hp -o value used $zpool`; echo $pool $snap|awk '{print (\$1-\$2);}';done"
extend .1.3.6.1.4.1.2021.88 zpool_available /bin/bash -c "sudo zpool list -Ho name|xargs sudo zfs get -Hp -o value available"
extend .1.3.6.1.4.1.2021.88 zpool_capacity /bin/bash -c "sudo zpool list -H -o capacity"

#ARC Usage
extend .1.3.6.1.4.1.2021.85 arc_meta_max /bin/bash -c "sudo grep arc_meta_max /proc/spl/kstat/zfs/arcstats |awk -F' ' '{print $(NF)}'"
extend .1.3.6.1.4.1.2021.85 arc_meta_used /bin/bash -c "sudo grep arc_meta_used /proc/spl/kstat/zfs/arcstats |awk -F' ' '{print $(NF)}'"
extend .1.3.6.1.4.1.2021.85 arc_size /bin/bash -c "sudo grep -m 1 size /proc/spl/kstat/zfs/arcstats |awk -F' ' '{print $(NF)}'"
extend .1.3.6.1.4.1.2021.85 arc_meta_limit /bin/bash -c "sudo grep arc_meta_limit /proc/spl/kstat/zfs/arcstats |awk -F' ' '{print $(NF)}'"
extend .1.3.6.1.4.1.2021.85 arc_meta_c_max /bin/bash -c "sudo grep c_max /proc/spl/kstat/zfs/arcstats |awk -F' ' '{print $(NF)}'"

#ARC Stats
extend .1.3.6.1.4.1.2021.89 arc_hits /bin/bash -c "sudo grep -m 1 hits /proc/spl/kstat/zfs/arcstats |awk -F' ' '{print $(NF)}'"
extend .1.3.6.1.4.1.2021.89 arc_misses /bin/bash -c "sudo grep misses /proc/spl/kstat/zfs/arcstats |awk -F' ' '{print $(NF)}'"

#L2ARC Stats
extend .1.3.6.1.4.1.2021.89 arc_l2_hits /bin/bash -c "sudo grep l2_hits /proc/spl/kstat/zfs/arcstats |awk -F' ' '{print $(NF)}'"
extend .1.3.6.1.4.1.2021.89 arc_l2_misses /bin/bash -c "sudo grep l2_misses /proc/spl/kstat/zfs/arcstats |awk -F' ' '{print $(NF)}'"

#VFS IOPS
extend .1.3.6.1.4.1.2021.90 vopstats_zfs_nread /bin/bash -c "humnum=$(sudo zpool iostat | tail -n 1 | awk -F' ' '{print $4}') ; case ${humnum: -1:1} in [0-9]) echo $humnum | tr -d ' ' ;; 'K') bc -p ${humnum: 0:-1}*1024**1 | tr -d ' ' ;; 'M') bc -p ${humnum: 0:-1}*1024**2 | tr -d ' ' ;; 'G') bc -p ${humnum: 0:-1}*1024**3 | tr -d ' ' ;; 'T') bc -p ${humnum: 0:-1}*1024**4 | tr -d ' ' ;; 'P') bc -p ${humnum: 0:-1}*1024**5 ;; esac"
extend .1.3.6.1.4.1.2021.90 vopstats_zfs_nwrite /bin/bash -c "humnum=$(sudo zpool iostat | tail -n 1 | awk -F' ' '{print $5}') ; case ${humnum: -1:1} in [0-9]) echo $humnum | tr -d ' ' ;; 'K') bc -p ${humnum: 0:-1}*1024**1 | tr -d ' ' ;; 'M') bc -p ${humnum: 0:-1}*1024**2 | tr -d ' ' ;; 'G') bc -p ${humnum: 0:-1}*1024**3 | tr -d ' ' ;; 'T') bc -p ${humnum: 0:-1}*1024**4 | tr -d ' ' ;; 'P') bc -p ${humnum: 0:-1}*1024**5 ;; esac"

#VFS Throughput
extend .1.3.6.1.4.1.2021.90 vopstats_zfs_read_bytes /bin/bash -c "humnum=$(sudo zpool iostat | tail -n 1 | awk -F' ' '{print $6}') ; case ${humnum: -1:1} in [0-9]) echo $humnum | tr -d ' ' ;; 'K') bc -p ${humnum: 0:-1}*1024**1 | tr -d ' ' ;; 'M') bc -p ${humnum: 0:-1}*1024**2 | tr -d ' ' ;; 'G') calc -p ${humnum: 0:-1}*1024**3 | tr -d ' ' ;; 'T') calc -p ${humnum: 0:-1}*1024**4 | tr -d ' ' ;; 'P') calc -p ${humnum: 0:-1}*1024**5 ;; esac"
extend .1.3.6.1.4.1.2021.90 vopstats_zfs_write_bytes /bin/bash -c "humnum=$(sudo zpool iostat | tail -n 1 | awk -F' ' '{print $7}') ; case ${humnum: -1:1} in [0-9]) echo $humnum | tr -d ' ' ;; 'K') bc -p ${humnum: 0:-1}*1024**1 | tr -d ' ' ;; 'M') bc -p ${humnum: 0:-1}*1024**2 | tr -d ' ' ;; 'G') bc -p ${humnum: 0:-1}*1024**3 | tr -d ' ' ;; 'T') bc -p ${humnum: 0:-1}*1024**4 | tr -d ' ' ;; 'P') bc -p ${humnum: 0:-1}*1024**5 ;; esac"

#DeDupe Ratio
extend .1.3.6.1.4.1.2021.91 zfs_dedup_ratio /bin/bash -c "zpool list | grep vol | cut -d \" \" -f 13 | tr -cd '[:digit:]'"

LibreNMS:
https://community.librenms.org/t/zfs-support/1839

https://docs.librenms.org/#Extensions/Applications/#zfs

The post ZFS – SNMP appeared first on F1-CONSULT.

]]>
ZFS – Replacing a dead disk in a zpool https://www.f1-consult.com/linux/storage/zfs/zfs-replacing-a-dead-disk/ Tue, 13 Feb 2018 13:15:05 +0000 https://www.f1-consult.com/?p=3332 ZFS – Single Path 1. Check zpool status: zpool status vol -x 2. Find the {GUID} of the {dead-disk} within zdb: zdb -l /dev/{dead-disk} 3. Offline the the {dead-disk} within zdb: zpool offline vol /dev/disk/by-id/{dead-disk} 4. Detach the {dead-disk} disk: zpool detach vol /dev/disk/by-id/{dead-disk} 5. Replace the {dead-disk} disk: zpool replace {your_poolname} {drive to be […]

The post ZFS – Replacing a dead disk in a zpool appeared first on F1-CONSULT.

]]>
ZFS – Single Path
1. Check zpool status:
zpool status vol -x

2. Find the {GUID} of the {dead-disk} within zdb:
zdb -l /dev/{dead-disk}

3. Offline the the {dead-disk} within zdb:
zpool offline vol /dev/disk/by-id/{dead-disk}

4. Detach the {dead-disk} disk:
zpool detach vol /dev/disk/by-id/{dead-disk}

5. Replace the {dead-disk} disk:
zpool replace {your_poolname} {drive to be replaced} {new drive to take its place}
zpool replace vol <GUID> /dev/disk/by-id/{new-disk}

6. Check zpool status:
zpool status vol -x

ZFS – Multi Path

1. Physically remove disk

2. Find failed multipath disk
multipath -ll

3. Remove multipath disk
multipath -F

4. Physically insert new disk (record WWN from drive label first)

5. Add the WWN to /etc/multipath.conf as a new alias (WWN can be found on physical disk label, for WD disks, add a 3 to the beginning)

6. reload multipath service (only reloads config and rescans, will not interrupt live systems)
service multipathd reload
multipath -v2
multipath -ll A14

The post ZFS – Replacing a dead disk in a zpool appeared first on F1-CONSULT.

]]>