nas:zfs:options_for_zfs_on_raid
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| nas:zfs:options_for_zfs_on_raid [2024/12/17 17:20] – admin | nas:zfs:options_for_zfs_on_raid [2025/02/12 11:13] (current) – admin | ||
|---|---|---|---|
| Line 5: | Line 5: | ||
| |--|--------------|--------------|------------------------------| | |--|--------------|--------------|------------------------------| | ||
| |Levels| Mirror/1, RAIDZ1/5, RAIDZ2/6, RAIDZ3, dRAID | Mirror/1, RAID5, RAID6 | Mirror/1, RAID5, RAID6 | | |Levels| Mirror/1, RAIDZ1/5, RAIDZ2/6, RAIDZ3, dRAID | Mirror/1, RAID5, RAID6 | Mirror/1, RAID5, RAID6 | | ||
| - | |Data checksums in FS| Yes |Yes | probably not | | + | |Data checksums in FS| Yes | Yes | probably not | |
| + | |Corruption detection for individual files | Yes | Yes | probably not | | ||
| + | |Automatic corruption fix from redundancy data | Yes | only on RAID6 | only on RAID6, can go undetected | ||
| ## ZFS specific terms | ## ZFS specific terms | ||
| - | Resilvering: | + | |
| - | RAIDZx: Number of drives that can fail. Up to three at the moment. | + | * **Resilvering**: RAID rebuild or drive initialization. |
| - | dRAID: RAID stripes are distributed among that drives including hot spare. Leads to faster repair after a disk swap. | + | * **RAIDZx**: Number of drives that can fail. Up to three at the moment. |
| + | * **dRAID**: RAID stripes are distributed among that drives including hot spare. Leads to faster repair after a disk swap. | ||
| ## Why no hardware raid with ZFS on it | ## Why no hardware raid with ZFS on it | ||
| Line 23: | Line 26: | ||
| On Fedora there is a `resource-agent` package that contains an agent for use with ZFS. The same version is available on CentOS 10 stream but it does not contain the ZFS agent. | On Fedora there is a `resource-agent` package that contains an agent for use with ZFS. The same version is available on CentOS 10 stream but it does not contain the ZFS agent. | ||
| - | The [packages for Fedora 42 can be rebuilt](https:// | + | The [packages for Fedora 42 can be rebuilt](https:// |
| - | There is an option to use a prebuilt module with EL 9. This is however not signed for use with EFI Secure Boot. the DKMS build system signs its artifacts automatically but of course pulls in a lot of dependencies. | + | |
| - | There is an [official repository | + | There is an [official repository for ZFS packages](https:// |
| - | To make use of the snapshot and send/ | + | There is an option to use a prebuilt module with EL 9. This is however not signed for use with EFI Secure Boot. the DKMS build system signs its artifacts automatically but of course pulls in a lot of dependencies. |
| + | |||
| + | To gain any additional safety | ||
| + | |||
| + | To make use of the snapshot and send/ | ||
| Install instructions: | Install instructions: | ||
| - | ```sh | + | ```bash |
| sudo dnf install -y https:// | sudo dnf install -y https:// | ||
| sudo dnf config-manager --enable zfs-testing | sudo dnf config-manager --enable zfs-testing | ||
| Line 39: | Line 46: | ||
| ``` | ``` | ||
| In the mok util enroll the key. Use the password you just set. | In the mok util enroll the key. Use the password you just set. | ||
| - | ```sh | + | |
| + | It is possible to set the size for the [ARC](https:// | ||
| + | ``` | ||
| + | options zfs zfs_arc_max=8589934592 zfs_arc_min=8589934592 | ||
| + | ``` | ||
| + | This limits the size of the ARC to 8GB and reserves these 8GB on module load. | ||
| + | If not set, there is an automatic that usually does a good job but uses up the half of the systems memory for the ARC. | ||
| + | ```bash | ||
| sudo modprobe zfs # this will not work on an EFI Secure Boot system without the MOK enrolement | sudo modprobe zfs # this will not work on an EFI Secure Boot system without the MOK enrolement | ||
| - | sudo pcs resource | + | # Disable services meant for automatic import on startup -> we do this with pcs |
| - | sudo pcs resource create | + | sudo systemctl disable --now zfs-share.service zfs-import-cache.service zfs-mount.service |
| - | sudo pcs resource group add nfsgroup | + | |
| - | sudo pcs resource group add nfsgroup | + | sudo dnf install -y https:// |
| + | |||
| + | pcs resource create nfsshare | ||
| + | pcs resource create | ||
| + | pcs resource create nfsshare-mirror | ||
| + | pcs resource create zfs-scrub-monthly-nfsshare-mirror systemd\: | ||
| + | pcs resource group add nfsgroup | ||
| + | pcs resource group add nfsgroup | ||
| + | pcs resource group add nfsgroup nfsshare-mirror | ||
| + | pcs resource group add nfsgroup zfs-scrub-monthly-nfsshare-mirror --after nfsshare-mirror | ||
| + | ``` | ||
| + | ```bash | ||
| sudo dnf install python3-coloredlogs python3-jsonschema python3-isodate python3-croniter python3-paramiko | sudo dnf install python3-coloredlogs python3-jsonschema python3-isodate python3-croniter python3-paramiko | ||
| - | sudo dnf install python3-zettarepl-24.10.1-2.noarch.rpm | + | sudo dnf install |
| - | sudo nano / | + | sudo vi / |
| ``` | ``` | ||
| ```ini | ```ini | ||
| Line 58: | Line 83: | ||
| [Service] | [Service] | ||
| Environment=PYTHONPATH=/ | Environment=PYTHONPATH=/ | ||
| - | ExecStart=/ | + | ExecStart=/ |
| ``` | ``` | ||
| Note: No install section it will be launched using pacemaker. | Note: No install section it will be launched using pacemaker. | ||
| ```sh | ```sh | ||
| - | sudo mkdir /shared-ZFS-1/config | + | sudo mkdir /nfsshare/config |
| - | sudo nano /shared-ZFS-1/ | + | sudo nano /nfsshare/ |
| ``` | ``` | ||
| ```yaml | ```yaml | ||
| Line 69: | Line 94: | ||
| periodic-snapshot-tasks: | periodic-snapshot-tasks: | ||
| # Each task in zettarepl must have an unique id to make references for it | # Each task in zettarepl must have an unique id to make references for it | ||
| - | | + | |
| # Dataset to make snapshots | # Dataset to make snapshots | ||
| - | dataset: | + | dataset: |
| # You must explicitly specify if you want recursive or non-recursive | # You must explicitly specify if you want recursive or non-recursive | ||
| # snapshots | # snapshots | ||
| Line 111: | Line 136: | ||
| schedule: | schedule: | ||
| minute: " | minute: " | ||
| - | | + | |
| - | dataset: | + | dataset: |
| recursive: true | recursive: true | ||
| #exclude: | #exclude: | ||
| - | # - shared-ZFS-1/xyz | + | # - nfsshare/xyz |
| lifetime: P1D | lifetime: P1D | ||
| # | # | ||
| Line 123: | Line 148: | ||
| hour: " | hour: " | ||
| replication-tasks: | replication-tasks: | ||
| - | | + | |
| # Either push or pull | # Either push or pull | ||
| direction: push | direction: push | ||
| Line 132: | Line 157: | ||
| type: local | type: local | ||
| # Source dataset | # Source dataset | ||
| - | source-dataset: | + | source-dataset: |
| # Target dataset | # Target dataset | ||
| - | target-dataset: | + | target-dataset: |
| # " | # " | ||
| # snapshot tasks | # snapshot tasks | ||
| Line 155: | Line 180: | ||
| # exclude all child snapshots that your periodic snapshot tasks exclude | # exclude all child snapshots that your periodic snapshot tasks exclude | ||
| periodic-snapshot-tasks: | periodic-snapshot-tasks: | ||
| - | - shared-ZFS-1-qh | + | - nfsshare-qh |
| - | - shared-ZFS-1-hour | + | - nfsshare-hour |
| # If true, replication task will run automatically either after bound | # If true, replication task will run automatically either after bound | ||
| # periodic snapshot task or on schedule | # periodic snapshot task or on schedule | ||
| Line 168: | Line 193: | ||
| sudo systemctl daemon-reload | sudo systemctl daemon-reload | ||
| sudo pcs resource create zettarepl systemd\: | sudo pcs resource create zettarepl systemd\: | ||
| - | sudo pcs resource group add nfsgroup zettarepl --after | + | sudo pcs resource group add nfsgroup zettarepl --after |
| + | ``` | ||
| + | |||
| + | ## Incompatibility between zfs' handling of nfs and resource-agents | ||
| + | |||
| + | The `ocf: | ||
| + | zfs also has the ability to contain nfs setup instructions and will use `exportfs` to reconfigure nfs. It however does write something to disk and assumes that there is a configuration on diks for any exports. it calls ` exportfs -ra` which " | ||
| + | |||
| + | This combination kills the nfs connections for a short period of time on certain zfs operations like taking snapshots. | ||
| + | |||
| + | The quick and dirty fix for this is to make the `ocf: | ||
| + | |||
| + | ```diff | ||
| + | --- / | ||
| + | +++ / | ||
| + | @@ -339,6 +339,7 @@ | ||
| + | fi | ||
| + | |||
| + | ocf_log info " | ||
| + | + cp / | ||
| + | return $OCF_SUCCESS | ||
| + | } | ||
| + | | ||
| + | @@ -403,6 +404,7 @@ | ||
| + | | ||
| + | local dir=$1 | ||
| + | ocf_run exportfs -v -u ${OCF_RESKEY_clientspec}: | ||
| + | + cp / | ||
| + | } | ||
| + | | ||
| + | { | ||
| ``` | ``` | ||
| + | ## On ZFS virtual device types | ||
| + | [Write up](https:// | ||
| + | * LOG: Maybe useful for NFS exports. Can be very small (32 GB), should have very low latency. | ||
| + | * L2ARC: Read cache, rarely useful. | ||
| + | * SPECIAL: If enabled contains the whole metadata so is a point of failure. Can contain small files. Should be an SSD. | ||
nas/zfs/options_for_zfs_on_raid.1734452406.txt.gz · Last modified: by admin