ਸਥਿਰਤਾ ਨਾਲ ਮੇਜ਼ਬਾਨੀ, ਪ੍ਰਬੰਧਿਤ F/OSS ਵਸਤੂ ਸਟੋਰੇਜ਼, Redis, Prometheus Hetzner, OVH ਅਤੇ LeaseWeb 'ਤੇ **tl;dr - Hetzner's ਸਮਰਪਿਤ ਹਾਰਡਵੇਅਰ (Ubuntu 20.04 - âÂÂFocalâÂÂ) 'ਤੇ ਵਰਤਣ ਲਈ ਮੇਰੀ ਜਵਾਬਦੇਹ-ਸੰਚਾਲਿਤ ZFS ਇੰਸਟਾਲ ਸਕ੍ਰਿਪਟ ਦੀ ਲਾਈਨ-ਦਰ-ਲਾਈਨ ਵਿਆਖਿਆ  ਇਹ ਸੰਪੂਰਨ/ਘੱਟੋ-ਘੱਟ ਨਹੀਂ ਹੈ, ਪਰ ਇਹ ਮੇਰੇ ਲਈ ਕੰਮ ਕਰਦਾ ਹੈ ਕੁਝ ਸਮਾਂ ਪਹਿਲਾਂ ਮੈਂ ਅਟੈਚਡ HDDs ਅਤੇ SSDs ਨੂੰ ਹੱਲ ਕਰਨ ਲਈ ਹੇਟਜ਼ਨਰ ਵਿਖੇ ਹੋਸਟ ਕੀਤੇ ਆਪਣੇ ਸਾਰੇ ਬੇਅਰ ਮੈਟਲ ਸਮਰਪਿਤ ਹਾਰਡਵੇਅਰ 'ਤੇ ZFS ਦੀ ਵਰਤੋਂ ਕਰਨੀ ਸ਼ੁਰੂ ਕੀਤੀ ਸੀ। ਸਪੇਸ ਵਿੱਚ ਬਹੁਤ ਸਾਰੀਆਂ ਚੋਣਾਂ ਹਨ (ਸਟੈਂਡਰਡ LVM, mdraid btrfs, ਆਦਿ), ਪਰ ਮੈਂ ZFS ਨੂੰ ਇਸਦੇ ਫੈਉਰਸੈੱਟ ਅਤੇ ਐਰਗੋਨੋਮਿਕਸ ਲਈ ਚੁਣਿਆ ਹੈ। ਮੈਂ ਕਿਸੇ ਨੂੰ ਇਸ ਕਾਰਨ ਨਾਲ ਬੋਰ ਨਹੀਂ ਕਰਾਂਗਾ, ਪਰ ਇੱਕ ਚੀਜ਼ ਜਿਸ ਦੀ ਮੈਨੂੰ ਨੈਵੀਗੇਟ ਕਰਨ ਦੀ ਜ਼ਰੂਰਤ ਸੀ ਉਹ ਸੀ Ubuntu 20.04 (Hetzner 'ਤੇ ਸਮਰਥਿਤ ਓਪਰੇਟਿੰਗ ਸਿਸਟਮਾਂ ਵਿੱਚੋਂ ਇੱਕ) 'ਤੇ ZFS ਦੇ ਨਵੇਂ ਸੰਸਕਰਣਾਂ ਨੂੰ ਕਿਵੇਂ ਸਥਾਪਿਤ ਕਰਨਾ ਹੈ। ਮੈਨੂੰ ਆਪਣੇ ਸਿਸਟਮਾਂ 'ਤੇ ZFS ਸੈਟ ਅਪ ਕਰਦੇ ਸਮੇਂ ਕੁਝ ਸਮੱਸਿਆਵਾਂ (ਖਾਸ ਤੌਰ 'ਤੇ ਪੋਸਟ-ਇੰਸਟਾਲ) ਦਾ ਸਾਹਮਣਾ ਕਰਨਾ ਪਿਆ ਇਸਲਈ ਮੈਂ ਇਸ ਬਾਰੇ ਵਾਕਥਰੂ ਦੇਣਾ ਚਾਹੁੰਦਾ ਸੀ ਕਿ ਮੈਂ ਇਹ ਕਿਵੇਂ ਕੀਤਾ। ਇਹ ਪੋਸਟ ਮੇਰੀਆਂ ਜਵਾਬਦੇਹ ਸਕ੍ਰਿਪਟਾਂ ਦੀ ਇੱਕ ਪਉੜੀ-ਦਰ-ਸਟੰਦ ਵਿਆਖਿਆ ਹੈ ਜੋ ZFS ਨੂੰ ਸਥਾਪਿਤ ਕਰਦੀਆਂ ਹਨ। ਇਸ ਤੋਂ ਪਹਿਲਾਂ ਕਿ ਤੁਹਾਨੂੰ ਪਤਾ ਹੋਵੇ ਕਿ ਕੀ ZFS (ਜਾਂ ਕੋਈ ਫਾਈਲ ਸਿਸਟਮ) ਨੂੰ ਬਦਲਣ ਦੇ ਯੋਗ ਹੈ, ਤੁਸੀਂ ਸ਼ਾਇਦ RTFM ਕਰਨਾ ਚਾਹੋਗੇ। ZFS ਦੇ ਬਹੁਤ ਸਾਰੇ ਇਨਸ ਹਨ ਅਤੇ ਮੈਂ ਨਿਸ਼ਚਤ ਤੌਰ 'ਤੇ ਇਸ ਵਿੱਚ ਮਾਹਰ ਨਹੀਂ ਹਾਂ, ਪਰ ਇਹ ਜਾਣਨਾ ਕਿ ਕਿਵੇਂ ਅਤੇ ਕਿਉਂ, ਨਾਲ ਹੀ ਪਰਿਭਾਸ਼ਾ ਅਤੇ ਇੱਥੋਂ ਤੱਕ ਕਿ ਪ੍ਰੋਜੈਕਟ ਦਾ ਇਤਿਹਾਸ ਬਹੁਤ ਮਹੱਤਵਪੂਰਨ ਹੈ। ਤੁਹਾਨੂੰ ਸ਼ੁਰੂ ਕਰਨ ਲਈ ਕੁਝ ਲਿੰਕ: ZFS (ਜੋ ਕਿ ਇੱਥੇ ਸਭ ਤੋਂ ਅਣਜਾਣ ਮਾਤਰਾ ਹੈ) ਦੇ ਨਾਲ ਤੁਸੀਂ ਸ਼ਾਇਦ ਉਬੰਟੂ ਅਤੇ ਆਮ ਸਿਸਟਮ ਪ੍ਰਸ਼ਾਸਨ ਤੋਂ ਜਾਣੂ ਹੋਣਾ ਚਾਹੁੰਦੇ ਹੋ। ਇਹ ਕਵਰ ਕਰਨ ਲਈ ਇੱਕ ਵੱਡਾ ਖੇਤਰ ਛੱਡ ਰਿਹਾ ਹੈ ਪਰ ਇੱਥੇ ਕੁਝ ਲਿੰਕ ਹਨ: ਇਹ ਲਗਭਗ ਬਿਨਾਂ ਕਹੇ ਚਲਦਾ ਹੈ ਪਰ ਜੇਕਰ ਤੁਸੀਂ ਇਸ ਸਮੇਂ ਲੀਨਕਸ ਸਿਸਟਮ ਪ੍ਰਸ਼ਾਸਨ ਤੋਂ ਬਹੁਤ ਜਾਣੂ ਨਹੀਂ ਹੋ, ਤਾਂ ਤੁਹਾਨੂੰ ਸ਼ਾਇਦ ਇਸਦੀ ਕੋਸ਼ਿਸ਼ ਨਹੀਂ ਕਰਨੀ ਚਾਹੀਦੀ। ਮੈਂ ਨਿੱਜੀ ਤੌਰ 'ਤੇ ਆਪਣੀਆਂ ਡਿਸਕਾਂ ਨੂੰ ਕੁਝ ਕਸਟਮ ਕੌਂਫਿਗਰੇਸ਼ਨ ਵਿੱਚ ਰੱਖਣਾ ਚੁਣਦਾ ਹਾਂ - ਮੇਰੇ ਕੋਲ RAID1 (ਮਿਰਰਿੰਗ) ਸੈਟਅਪ ਦੁਆਰਾ mdraid, ਹਰੇਕ ਡਿਸਕ ਦੇ ਭਾਗਾਂ ਦੇ ਨਾਲ ਜੋ ਮੈਂ ZFS ਨੂੰ ਪ੍ਰਬੰਧਿਤ ਕਰਨ ਲਈ ਦੇ ਸਕਦਾ ਹਾਂ। ਆਦਰਸ਼ਕ ਤੌਰ 'ਤੇ, ZFS ਨੂੰ ਦੇਣ ਲਈ ਮੇਰੇ ਕੋਲ ਪੂਰੀ ਡਿਸਕਾਂ ਹਨ ਪਰ ਭਾਗ ਵੀ ਕੰਮ ਕਰਦੇ ਹਨ। OS ਸੈੱਟਅੱਪ ( installimage) ਜਿਸ ਵਿੱਚ ਡਿਸਕ ਸੈਟਅਪ ਸ਼ਾਮਲ ਹੈ Hetznerà ¢Â ਦੇ ਬਚਾਅ ਮੋਡ ਤੋਂ ਚਲਾਇਆ ਜਾਂਦਾ ਹੈ ਅਤੇ ਹੇਠ ਲਿਖੀਆਂ ਫਾਈਲਾਂ ਨਾਲ ਗਾਈਡ ਕੀਤਾ ਜਾ ਸਕਦਾ ਹੈ: # ਇੰਸਟਾਲੇਸ਼ਨ ਦੁਆਰਾ ਵਰਤੇ ਗਏ ਡਰਾਈਵ ਘੋਸ਼ਣਾਵਾਂ DRIVE0 /dev/nvme0n1 DRIVE1 /dev/nvme1n1 # ਸੌਫਟਵੇਅਰ ਰੇਡ ਨੂੰ ਸਮਰੱਥ ਬਣਾਓ (OS ਡਿਸਕ ਲਈ) SWRAID 1 SWRAIDLEVEL 1 # ਬੂਟਲੋਡਰ (ਆਮ ਤੌਰ 'ਤੇ ਗਰਬ) BOOTLOADER Partine grub #1 Mahostine Partition #1 ਸੰਰਚਨਾ PART ਸਵੈਪ ਸਵੈਪ 32G PART /boot ext4 1G PART / ext4 128G # ਇਹ ਆਖਰੀ ਭਾਗ ਬਣ ਜਾਵੇਗਾ (ਪੂੰਝ& ਬਾਅਦ ਵਿੱਚ ZFS ਦੇ ਤੌਰ ਤੇ ਦੁਬਾਰਾ ਬਣਾਇਆ ਗਿਆ) PART /root-disk-remaining ext4 all # ਤੁਸੀਂ ਉਹਨਾਂ ਚਿੱਤਰਾਂ ਨੂੰ ਨਿਰਧਾਰਿਤ ਕਰ ਸਕਦੇ ਹੋ ਜੋ Hetzner ਉਹਨਾਂ ਦੇ ਨੈੱਟਵਰਕ ਸ਼ੇਅਰ IMAGE /root/.oldroot/nfs/images/Ubuntu-2004-focal-64-minimal.tar ਤੱਕ ਪਹੁੰਚ ਕਰਕੇ ਵਰਤਦਾ ਹੈ। gz ਇਹ ਸਪੱਸ਼ਟ ਤੌਰ 'ਤੇ ਕਾਫ਼ੀ ਹੇਟਜ਼ਨਰ-ਵਿਸ਼ੇਸ਼ ਹੈ, ਪਰ ZFS ਦੀ ਵਰਤੋਂ ਕਰਨ ਲਈ ਭਾਗ/ਡਰਾਈਵ ਉਪਲਬਧ ਹੋਣ ਲਈ ਤੁਹਾਨੂੰ ਆਪਣੇ ਸਿਸਟਮਾਂ 'ਤੇ ਜੋ ਵੀ ਕਰਨ ਦੀ ਲੋੜ ਹੈ ਉਹ ਕਰੋ। zfsutils-linuxand zfs-zed ਜਵਾਬਦੇਹ YAML ਵਿੱਚ ਕਦਮ ਇਸ ਤਰ੍ਹਾਂ ਦਿਖਾਈ ਦਿੰਦਾ ਹੈ: - ਨਾਮ: ਸਾਰੇ zfs-ਸਬੰਧਤ ਅੱਪਸਟਰੀਮ ਪੈਕੇਜਾਂ ਨੂੰ ਹੋਲਡ ਕਰੋ ansible.builtin.shell: | apt-mark ਹੋਲਡ zfsutils-linux apt-mark ਹੋਲਡ zfs-zed ਇਸ ਪੋਸਟ ਦੇ ਲਿਖਣ ਦੇ ਰੂਪ ਵਿੱਚ ਦਾ ਸੰਸਕਰਣ ਉਬੰਟੂ ਫੋਕਲ ਵਿੱਚ zfs-linux 0.8.3 ਹੈ। ਕਿਉਂਕਿ ਇੱਥੇ ਸਾਡਾ ਟੀਚਾ ਇੱਕ ਨਵੇਂ ਸੰਸਕਰਣ ਨੂੰ ਸਥਾਪਿਤ ਕਰਨਾ ਅਤੇ ਵਰਤਣਾ ਜਾਰੀ ਰੱਖਣਾ ਹੈ, ਅਸੀਂ ਇਹ ਯਕੀਨੀ ਬਣਾਉਣਾ ਚਾਹੁੰਦੇ ਹਾਂ ਕਿ ਕੋਈ ਵੀ apt ਅੱਪਡੇਟ ਸਾਡੇ ਸਥਾਪਤ ਕੀਤੇ ਸੰਸਕਰਣ ਨੂੰ ਪੁਰਾਣੇ ਸੰਸਕਰਣ ਨਾਲ ਨਹੀਂ ਬਦਲਦੇ ਹਨ। ਜਦੋਂ ਅਸੀਂ ਇੱਥੇ ਹਾਂ, ਆਓ ਪੈਕੇਜਾਂ ਨੂੰ ਵੀ ਸਾਫ਼ ਕਰੀਏ। - ਨਾਮ: ZFS ਅੱਪਸਟਰੀਮ (ਉਬੰਟੂ) ਪੈਕੇਜਾਂ ਨੂੰ ਪਰਜ ਕਰੋ ਜੇਕਰ ਇੰਸਟਾਲ ਕੀਤਾ ਹੈ ignore_errors: yes ansible.builtin.command: | apt purge --allow-change-held-packages zfsutils-linux zfs-zed ਤੁਸੀਂ 'ਤੇ ਦਸਤਾਵੇਜ਼ ਪੜ੍ਹ ਸਕਦੇ ਹੋ ਕੀ ਦੇਖਣ ਲਈ ਢੁਕਵਾਂ purge ਇਹ ਹਟਾਉਣ ਦੇ ਸਮਾਨ ਹੈ ਪਰ ਜੇ ਮੌਜੂਦ ਹੋਵੇ ਤਾਂ ਸੰਰਚਨਾ ਫਾਈਲਾਂ ਨੂੰ ਵੀ ਹਟਾਉਂਦਾ ਹੈ। ਤੁਸੀਂ OpenZFS ਲਈ ਨਿਰਭਰਤਾਵਾਂ ਨੂੰ ਇਸ ਤਰ੍ਹਾਂ ਸਥਾਪਿਤ ਕਰ ਸਕਦੇ ਹੋ: - ਨਾਮ: ZFS ansible.builtin.apt ਬਣਾਉਣ ਲਈ ਲੋੜਾਂ ਨੂੰ ਸਥਾਪਿਤ ਕਰੋ: name:packagesupdate_cache: ਹਾਂ ਰਾਜ: ਮੌਜੂਦ vars: ਪੈਕੇਜ: - ਬਿਲਡ-ਜ਼ਰੂਰੀ - autoconf - automake - libtool - gawk - alien - fakeroot - dkms - libblkid-dev - uuid -dev - libudev-dev - libssl-dev - zlib1g-dev - libaio-dev - libattr1-dev - libelf-dev # ਹੇਠਾਂ ਦਿੱਤੀ ਲਾਈਨ `uname -r` ਦੇ ਆਉਟਪੁੱਟ ਲਈ ਕਾਲ ਕਰਦੀ ਹੈ, ਉਦਾਹਰਨ ਲਈ "5.16.5-arch1- 1"ਮੇਰੇ arch ਸਿਸਟਮ ਲਈ # ਇਸ ਲਈ ਲਾਈਨ "linux-headers-5.16.5-arch1-1"(ਬੇਸ਼ੱਕ ਉਬੰਟੂ 'ਤੇ ਵੈਧ ਨਹੀਂ ਹੈ, ਪਰ ਇੱਕ ਉਦਾਹਰਣ ਵਜੋਂ) - linux-headers uname_r.stdout }} - python3 - python3-dev - python3-setuptools - python3-cffi - libffi-dev - python3-packaging - git - libcurl4-openssl-dev ਇੱਥੇ ਕੁਝ ਨਿਰਭਰਤਾਵਾਂ ਹੋ ਸਕਦੀਆਂ ਹਨ ਜੋ ਸਖਤੀ ਨਾਲ ਜ਼ਰੂਰੀ ਨਹੀਂ ਹਨ ਪਰ ਉਹਨਾਂ ਸਾਰਿਆਂ ਦੀ ਲੋੜ ਹੋਣੀ ਚਾਹੀਦੀ ਹੈ। /opt/zfs ਇੱਥੇ ZFS ਹੈ: - ਨਾਮ: ਬਣਾਓ /opt/zfs ansible.builtin.file: ਮਾਰਗ: /opt/zfs ਸਥਿਤੀ: ਡਾਇਰੈਕਟਰੀ ਜੇ ਤੁਸੀਂ ZFS ਨੂੰ ਡਾਊਨਲੋਡ ਕਰਨਾ ਚਾਹੁੰਦੇ ਹੋ: - ਨਾਮ: zfs ansible.builtin.get_url ਡਾਊਨਲੋਡ ਕਰੋ: url: "httpsgithub.com/openzfs/zfs/releases/download/zfs _zfs_version zfs _zfs_version tar.gz"checksum:_zfs_tarball_sha256/zfs_sticks:56/zfs_txm_56/zfsfs_check .gz"ਇੱਥੇ ਬਦਲ {{ _zfs_version }} ( 2.1.1 ਤੁਸੀਂ ਖੁਦ ਡਾਊਨਲੋਡ ਵੀ ਕਰਨਾ ਚਾਹੋਗੇ ਅਤੇ ਵਰਤਣ ਲਈ ਇੱਕ ਚੈੱਕਸਮ ਇਕੱਠਾ ਕਰਨਾ/ਜਨਰੇਟ ਕਰਨਾ ਚਾਹੋਗੇ। ਕਦੇ ਵੀ ਇੰਟਰਨੈੱਟ ਤੋਂ ਅਜਿਹੀ ਸਮੱਗਰੀ ਨੂੰ ਡਾਉਨਲੋਡ ਨਾ ਕਰੋ ਜਿਸ ਨੂੰ ਚੈਕਸਮ ਤੋਂ ਬਿਨਾਂ ਬਦਲਣਾ ਨਹੀਂ ਚਾਹੀਦਾ ਹੈ! {{Ansible ਟੈਂਪਲੇਟਿੰਗ ਸੰਟੈਕਸ ਹੈ) ਹੈ ਅਤੇ ਜੇਕਰ ਤੁਸੀਂ ਇਸ ਨੂੰ ਕੰਪਿਊਟਰ ਤੋਂ ਕਾਪੀ ਕਰਨਾ ਚਾਹੁੰਦੇ ਹੋ ਜਿੱਥੇ Ansible ਚੱਲ ਰਿਹਾ ਹੈ (ਇਹ ਮੈਂ ਕਰਦਾ ਹਾਂ): - ਨਾਮ: zfs ਪੈਕੇਜ ਕਾਪੀ ਕਰੋ (ਦਰ ਦੀ ਸੀਮਾ ਤੋਂ ਬਚੋ) ansible.builtin.copy: src: files/zfs/zfs _zfs_version tar.gz"ਮੋਡ: 0755 dest: "/opt/zfs/zfs _zfs_version tar.gz"ਭਾਵੇਂ ਤੁਸੀਂ ਸਰੋਤ ਪ੍ਰਾਪਤ ਕਰਨ ਦੀ ਚੋਣ ਕਿਵੇਂ ਕਰਦੇ ਹੋ, ਤੁਹਾਨੂੰ ਬੇਸ਼ਕ ਇਸਨੂੰ ਅਨਜ਼ਿਪ ਕਰਨ ਦੀ ਲੋੜ ਪਵੇਗੀ: - ਨਾਮ: ਅਨਜ਼ਿਪ zfs ਕੋਡ ansible.builtin.unarchive: src: "/opt/zfs/zfs _zfs_version tar.gz"dest: "/opt/zfs"remote_src: ਹਾਂ ਬਣਾਉਣ ਦੀ ਪ੍ਰਕਿਰਿਆ ਸ਼ੁਰੂ ਕਰਨ ਲਈ: - ਨਾਮ: ਸੈੱਟਅੱਪ ਅਤੇ ਬਿਲਡ ZFS ansible.builtin.shell: | ./autogen../configure make clean make -j args: chdir: "/opt/zfs/zfs _zfs_version ਜੇਕਰ ਤੁਸੀਂ ਸਰੋਤ ਤੋਂ ਚੀਜ਼ਾਂ ਬਣਾਉਣ ਤੋਂ ਜਾਣੂ ਹੋ, ਤਾਂ ਵੱਖ-ਵੱਖ ਪ੍ਰੋਜੈਕਟ ਇਸ ਸਾਂਝੇ ਟੂਲਸੈੱਟ ਦੀ ਵਰਤੋਂ ਕਰਦੇ ਹਨ (ਇਸ ਦੇ ਕੁਝ ਰੂਪ ਸਕ੍ਰਿਪਟਾਂ ਬਣਾਓ, ਆਟੋਜਨ ਅਤੇ ਕੌਂਫਿਗਰ ਕਰੋ)। ਜਿਵੇਂ ਕਿ ਤੁਸੀਂ ਉਮੀਦ ਕਰ ਸਕਦੇ ਹੋ ਕਿ ਇਸ ਵਿੱਚ ਕੁਝ ਸਮਾਂ ਲੱਗ ਸਕਦਾ ਹੈ ਇਸ ਲਈ ਇਸਨੂੰ ਕੁਝ ਸਮਾਂ ਦਿਓ। ZFS ਬਣਾਉਣ ਤੋਂ ਬਾਅਦ - ਨਾਮ: ZFS ansible.builtin.shell ਇੰਸਟਾਲ ਕਰੋ: | ਆਰਗਸ ਨੂੰ ਸਥਾਪਿਤ ਕਰੋ: chdir: "/opt/zfs/zfs _zfs_version ਆਮ ਤੌਰ 'ਤੇ ਤੁਸੀਂ ਸੋਚਦੇ ਹੋਵੋਗੇ ਕਿ ਅਸੀਂ *ਇੱਥੇ ਹੀ* ਕਰ ਲਵਾਂਗੇ, ਪਰ ਇਹ ਪੋਸਟ ਮੌਜੂਦ ਹੈ ਕਿਉਂਕਿ ਅਜਿਹਾ ਕਰਨਾ ਆਮ ਤੌਰ 'ਤੇ ਕਾਫ਼ੀ ਨਹੀਂ ਹੈ! ਚਲੋ ਅੱਗੇ ਦਬਾਓ। ਪਹਿਲਾਂ ZFS ਮੋਡੀਊਲ ਨੂੰ ਅਨਲੋਡ ਕਰਨ ਲਈ ਮਜਬੂਰ ਕਰੋ ਜੇਕਰ ਉਹ ਚੱਲ ਰਹੇ ਹਨ: - ਨਾਮ: ZFS ਮੋਡੀਊਲ (ss) ਨੂੰ ਜ਼ਬਰਦਸਤੀ ਅਨਲੋਡ ਕਰੋ ansible.builtin.shell: | ./scripts/zfs.-u args: chdir: "/opt/zfs/zfs _zfs_version ਜਦੋਂ ਅਜਿਹਾ ਹੋ ਰਿਹਾ ਹੋਵੇ ਤਾਂ *ਨਹੀਂ* ਕੰਮ ਦੇ ਬੋਝ ਨੂੰ ਚਲਾਉਣਾ ਆਦਰਸ਼ ਹੋਵੇਗਾ, ਜਿਵੇਂ ਕਿ ਤੁਸੀਂ ਉਮੀਦ ਕਰ ਸਕਦੇ ਹੋ। ਜਦੋਂ ਮੋਡਿਊਲ ਅਨਲੋਡ ਕੀਤੇ ਜਾਂਦੇ ਹਨ, ਅਸੀਂ ਕੁਝ ਸਹਾਇਕ ਸਥਾਪਤ ਕਰ ਸਕਦੇ ਹਾਂ: - ਨਾਮ: ਪੋਸਟ-ਇੰਸਟਾਲ ZFS ਸਹਾਇਕ ansible.builtin.shell: | ./scripts/zfs-helpers.-i args: chdir: "/opt/zfs/zfs _zfs_version ਸਹਾਇਕਾਂ ਦੇ ਸਥਾਪਿਤ ਹੋਣ ਤੋਂ ਬਾਅਦ, ਆਓ ਜ਼ਬਰਦਸਤੀ ZFS ਮੋਡੀਊਲ ਨੂੰ ਮੁੜ ਲੋਡ ਕਰੀਏ: - ਨਾਮ: ZFS ਮੋਡੀਊਲ ansible.builtin.shell ਦੇ ਦੁਬਾਰਾ ਲੋਡ ਕਰੋ: | ./scripts/zfs.args: chdir: "/opt/zfs/zfs _zfs_version ਮੈਂ ਉਹ ਇਮਾਰਤ ਲੱਭੀ ਹੈ ਅਤੇ ਇਸਦੀ ਵਰਤੋਂ ਕੀਤੀ ਹੈ deb ਮੋਡੀਊਲ (ਪੈਕੇਜ ਇੰਸਟਾਲੇਸ਼ਨ ਲਈ ਡੇਬੀਅਨ ਦੁਆਰਾ ਵਰਤਿਆ ਜਾਣ ਵਾਲਾ ਫਾਰਮੈਟ) ਨੇ ਇੰਸਟਾਲੇਸ਼ਨ ਨੂੰ ਸਟਿੱਕ ਕਰਨ ਅਤੇ ਉਬੰਟੂ ਪੈਕੇਜ ਡਿਫੌਲਟ ਦੁਆਰਾ ਤਬਦੀਲ ਨਾ ਕਰਨ ਵਿੱਚ ਮਦਦ ਕੀਤੀ। ਪਹਿਲਾਂ ਸਰੋਤ ਕੋਡ ਤੋਂ ZFS deb ਪੈਕੇਜ ਬਣਾਓ: - ਨਾਮ: ZFS deb ਪੈਕੇਜ ਬਣਾਓ ansible.builtin.shell: | deb args ਬਣਾਓ: chdir: "/opt/zfs/zfs _zfs_version ਅਤੇ ਫਿਰ ਇਸਨੂੰ ਇੰਸਟਾਲ ਕਰੋ - ਨਾਮ: ZFS deb ਪੈਕੇਜਾਂ ਨੂੰ ਇੰਸਟਾਲ ਕਰੋ ansible.builtin.shell: | ਹਾਂ | dpkg -i --force-overwrite deb apt install -f -y deb args: chdir: "/opt/zfs/zfs _zfs_version ਸਿਧਾਂਤਕ ਤੌਰ 'ਤੇ ਇਹ ਕਦਮ *ਜ਼ਰੂਰੀ ਨਹੀਂ ਹੋਣਾ ਚਾਹੀਦਾ (ਜਾਂ ਇਕੱਲੇ ਵਰਤਿਆ ਜਾਣਾ ਚਾਹੀਦਾ ਹੈ), ਕਿਉਂਕਿ ਅਸੀਂ ਪਹਿਲਾਂ ਹੀ ਇੱਕ ਸਥਾਪਨਾ ਪ੍ਰਕਿਰਿਆ ਚਲਾਈ ਹੈ, ਪਰ ਮੈਂ ਪਾਇਆ ਹੈ ਕਿ ਜਦੋਂ ਇੱਕ ਜਾਂ ਦੂਜਾ ਕੰਮ ਕਰਦੇ ਹਾਂ ਤਾਂ Iâ Âd ਦੀਆਂ ਅਜਿਹੀਆਂ ਸਥਿਤੀਆਂ ਹਨ ਜਿੱਥੇ ਮੁੜ-ਚਾਲੂ ਹੋਣ ਨਾਲ ZFS ਦੇ ਪੁਰਾਣੇ ਸੰਸਕਰਣ ਦੀ ਵਰਤੋਂ ਕਰਨ ਲਈ ਪ੍ਰੇਰਿਆ ਜਾਵੇਗਾ (ਦੇ ਬਾਵਜੂਦ apt purge) â ਖਾਸ ਕਰਕੇ ਕਰਨਲ ਪੱਧਰ 'ਤੇ। modprobe ਜੇ ਤੁਸੀਂ ZFS ਮੋਡੀਊਲ ਨੂੰ ਸਮਰੱਥ ਕਰਨਾ ਚਾਹੁੰਦੇ ਹੋ ਜੋ ਤੁਰੰਤ ਸਥਾਪਿਤ ਕੀਤਾ ਗਿਆ ਸੀ, ਤਾਂ ਵਰਤੋ modprobe: - ਨਾਮ: Modprobe zfs ਮੋਡੀਊਲ ਬਲਾਕ: - ਨਾਮ: zfs ਕਰਨਲ ਮੋਡੀਊਲ community.general.modprobe ਇੰਸਟਾਲ ਕਰੋ: ਨਾਮ: zfs ਰਾਜ: ਮੌਜੂਦ ZFS ਨੂੰ ਸਥਾਪਿਤ ਕਰਨ ਦਾ ਮਤਲਬ ਹੈ ਇੱਕ ਕਰਨਲ ਮੋਡੀਊਲ ਨੂੰ ਸਥਾਪਿਤ ਕਰਨਾ, ਪਰ ਕਿਉਂਕਿ ਅਸੀਂ ਇਸਨੂੰ ਡਾਇਨਾਮਿਕ ਕਰਨਲ ਮੋਡੀਊਲ ਸਪੋਰਟ ਦੁਆਰਾ ਬਿਲਕੁਲ ਬੇਕ ਨਹੀਂ ਕੀਤਾ ਹੈ, ਸਾਨੂੰ ਸਥਾਨਕ ਤੌਰ 'ਤੇ ਸਥਾਪਤ ਕਰਨਲ ਮੋਡੀਊਲ ਨੂੰ ਵਰਤਣ ਲਈ ਸਮਰੱਥ ਬਣਾਉਣ ਦੀ ਲੋੜ ਹੈ: - ਨਾਮ: ਯਕੀਨੀ ਬਣਾਓ ਕਿ ਵਾਧੂ ਸਾਹਮਣੇ ਹੈ ansible.builtin.lineinfile: path: /etc/modules-load.d/modules.conf regexp: '^search'ਲਾਈਨ: "ਖੋਜ ਵਾਧੂ ਅੱਪਡੇਟ ubuntu ਬਿਲਟ-ਇਨ"ਸਥਿਤੀ: ਮੌਜੂਦ ਇਹ ਕੀ ਕਰਦਾ ਹੈ ਇਹ ਯਕੀਨੀ ਬਣਾਉਂਦਾ ਹੈ ਕਿ ਫਾਈਲ ਜੋ ਕਰਨਲ ਮੋਡੀਊਲ ਖੋਜ ਮਾਰਗ ਦਾ ਪ੍ਰਬੰਧਨ ਕਰਦੀ ਹੈ /etc/modules-load.d/modules.conf ਵਿੱਚ ਇੱਕ ਲਾਈਨ ਹੈ ਜਿਸ ਵਿੱਚ ਹੈ ਖੋਜ ਵਾਧੂ ਅੱਪਡੇਟ ਨਿਰਧਾਰਿਤ. ਆਮ ਤੌਰ 'ਤੇ ਘੱਟੋ-ਘੱਟ ਇੱਕ ਲਾਈਨ ਹੁੰਦੀ ਹੈ ਜਿਸ ਨਾਲ ਸ਼ੁਰੂ ਹੁੰਦੀ ਹੈ ਖੋਜ ਕਰੋ, ਅਤੇ ਅਸੀਂ ਕੀ ਕਰਨਾ ਚਾਹੁੰਦੇ ਹਾਂ ਇਹ ਯਕੀਨੀ ਬਣਾਉਣਾ ਹੈ ਪ੍ਰਕਿਰਿਆ ਦੇ ਸ਼ੁਰੂ ਵਿੱਚ ਵਾਧੂ ਮੋਡੀਊਲ ਟਿਕਾਣਿਆਂ ਦੀ ਖੋਜ ਕੀਤੀ ਜਾਂਦੀ ਹੈ। ਅਸੀਂ DKMS ਸਬ-ਸਿਸਟਮ ਰਾਹੀਂ ਇੰਸਟਾਲ ਕਰਨਾ ਚਾਹਾਂਗੇ: - ਨਾਮ: dkms install zfs ansible.builtin.shell: | dkms install zfs _zfs_version }} args: chdir: "/opt/zfs/zfs _zfs_version ਇਸ ਬਿੰਦੂ 'ਤੇ, ਤੁਹਾਨੂੰ ਮੌਜੂਦਾ ਕਿਰਿਆਸ਼ੀਲ ZFS ਸੰਸਕਰਣ ਦੀ ਜਾਂਚ ਕਰਨ ਦੇ ਯੋਗ ਹੋਣਾ ਚਾਹੀਦਾ ਹੈ, ਅਤੇ ਇਹ ਤੁਹਾਨੂੰ ਇਸ ਤਰ੍ਹਾਂ ਦਿਖਾਉਣਾ ਚਾਹੀਦਾ ਹੈ: root@machine01 ~ # zfs ਵਰਜਨ zfs-2.1.1-1 zfs-kmod-2.1.1-1 ਇੱਥੇ ਕੁਝ ਸਿਸਟਮਡੀ ਯੂਨਿਟ ਹਨ (ਜਿਵੇਂ ਕਿ ਡਿਜੀਟਲ ਓਸ਼ਨ ਵਿੱਚ ਕੁਝ ਵਧੀਆ ਡੌਕਸ ਹੁੰਦੇ ਹਨ) ਜੋ ਬਣਾਏ ਗਏ ਹਨ ਪਰ ZFS ਨੂੰ ਵਰਤਣ ਲਈ ਸਮਰੱਥ ਕਰਨ ਦੀ ਲੋੜ ਹੈ: - ਨਾਮ: ਯਕੀਨੀ ਬਣਾਓ ਕਿ zfs-ਸਬੰਧਤ ਸਿਸਟਮਡ ਯੂਨਿਟ ਬਲੌਕ ਸਮਰਥਿਤ ਹਨ: - ansible.builtin.systemd: name:itemstate: ਚਾਲੂ ਕੀਤਾ ਗਿਆ: ਹਾਂ ਲੂਪ: - zfs-import-cache.service - zfs-import.target - zfs-mount.service - zfs-share.service - zfs-zed.service - zfs-volume-wait.service - zfs.target ਲੂਪ ਕੀਤੇ ਜਾ ਰਹੇ ਵੇਰੀਏਬਲ ਚੱਲਣ ਦੇ ਸਮਾਨ ਹਨ systemd start and systemd enable . The security-minded reader at home is no doubt cringing into the atmosphere by now, but making sure my kernel upgrades are manual is the only way I’ve found to ensure that the installed version of ZFS was not disabled/unexpectedly altered/broken by kernel upgrades: - name: Hold all kernel upgrades to prevent custom built ZFS from doing fallback ansible.builtin.shell: | apt-mark hold linux-headers-generic apt-mark hold linux-image-generic apt-mark hold {{ uname_r.stdout }} # you'll need that `uname -r` output again here I personally prefer to hold back any kernel upgrades and instead perform them at machine setup rather than during operation. DKMS *should* ensure that with the building of any new kernel the ZFS code is rebuilt but it’s been flaky in the past so I find it hard to trust. Along with all the kernel changes we’ve made so far (good and questionable), one thing we’ll want to do is add the configuration necessary to ensure the kernel module is loaded: - name: Ensure zfs kernel module comes up with next restart tags: [ "zfs:post-install:config" ] block: - name: Add zfs module load file ansible.builtin.template: src: templates/kernel-modules/zfs.conf.j2 dest: /etc/modules-load.d/zfs.conf owner: root group: root mode: 0644 Now that we have ZFS installed (restart once to check I’m going to leave the rest of the cluster setup to you. There are a *lot* of ways to use ZFS and setup zpools (RAID0/1/5/Z Actually using ZFS properly is out of scope (I can only hope I’ve covered *installing* it properly, at least), but please refer to the usual manuals there to set up your ZFS pool and storage requirements. Trying to cover even the basics of how to setup ZFS for your drives once it’s been installed is certainly a lot of reading so we’ll leave it there for today. This is the part where you “draw the rest of the owl” (sorry). txg_timeout While experimenting with some write modes for Postgres on ZFS, I looked into an optimization modes that involved reducing the txg_timeout from it’s default of 5 seconds to 1 second. While I won’t get into the tradeoffs implied by that move (please read my post on Postgres + ZFS), here is the setup that I’ve used for modifying txg_timeout per-machine (some machines might use the optimization some might not): - name: Add systemd unit to support txg timeout customization tags: [ "zfs:post-install:config" ] block: - name: Set current ZFS txg_timeout (to 1) ansible.builtin.shell: | echo 1 > /sys/module/zfs/parameters/zfs_txg_timeout - name: install zfs-config-txg-timeout service ansible.builtin.template: src: templates/zfs-config-txg-timeout.service.j2 dest: /etc/systemd/system/zfs-config-txg-timeout.service owner: root group: root mode: 0644 - name: start & enable zfs-config-txg-timeout service ansible.builtin.systemd: name: zfs-config-txg-timeout.service state: started enabled: yes daemon_reload: yes The template that goes with that looks like this: [Unit] Description=Set ZFS txg_timeout After=zfs.target ConditionPathIsDirectory=/sys/module/zfs [Service] Type=oneshot RemainAfterExit=yes ExecStart=/usr/bin/bash -c 'echo {{ _zfs_txg_timeout_seconds | default(zfs_txg_timeout_seconds) }} > /sys/module/zfs/parameters/zfs_txg_timeout' # Not needed since we want it to always be whatever the setting is # ExecStop=/usr/bin/bash -c 'echo {{ _zfs_txg_timeout_seconds | default(zfs_txg_timeout_seconds) }} > /sys/module/zfs/parameters/zfs_txg_timeout' [Install] WantedBy=multi-user.target Obviously you’ll want to define {{ _zfs_txg_timeout_seconds }} and the zfs_txg_timeout_seconds. In general, this will make sure that the txg_timeout is set to what you want it to be upon startup after ZFS has started. Wasn’t that easy? If you’re answering no, it wasn’t easy for me to figure out either! I spent a lot of time wondering why DKMS wasn’t working properly (which is why the hack of preventing kernel upgrades is still included) and dealing with other issues. The OpenZFS documentation is pretty great but seems to be missing a guide somewhat like this, so hopefully this post will save people some time going forward when trying to experiment with new ZFS setups on Hetzner. Another thing I’m hoping for with this post is to be corrected – if you see something glaringly wrong in my setup, please reach out. The more people can use low cost infrastructure providers like Hetzner, the more cool software we get and the more interesting/innovative products can be built. To that end I’m working on NimbusWS (I’m behind on this but should launch by end of Q1 2022) – if you’re interested please sign up for the service and kick the tires (free tier usage will be available).