workshops/eda-workshop-lsf/templates/04-nfs_server_instanceStore_zfs.yaml [553:622]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
              echo "Done installing ZFS"
            }

            function zfs_create {
              ##((zfs_nvme_first_dev = $local_nvme_last_dev + 1))
              ##((zfs_nvme_last_dev = $zfs_nvme_first_dev + 7))

              echo "Using these devices for ZFS:"
              sudo nvme list | grep "Amazon Elastic Block Store" | grep -v nvme0n1

              sudo /sbin/modprobe zfs
              modinfo zfs
              sudo zpool create -O compression=lz4 -O atime=off -O sync=disabled -f ${!zfs_pool_name} -o ashift=12 ${!dev_list}
              sudo zpool status -v
              sudo zfs create ${!zfs_pool_name}/${!zfs_mount_point}
            }

            function zfs_startup {
              sudo systemctl enable zfs-import-cache
              sudo systemctl enable zfs-mount.service
              sudo systemctl enable zfs.target
            }

            function nfs_server_settings {
              sudo su -c 'echo -e "STATD_PORT=\"32765\"\nSTATD_OUTGOING_PORT=\"32766\"\nSTATDARG=\"-p 32765 -o 32766\"\nMOUNTD_PORT=\"32767\"\nRPCMOUNTDOPTS=\"-p 32767\"
            LOCKD_UDPPORT=\"32768\"\nLOCKD_TCPPORT=\"32768\"\nRQUOTAD_PORT=\"32769\"\nRQUOTAD=\"no\"\nRPCNFSDCOUNT=\"128\""' > /etc/sysconfig/nfs
            }

            function nfs_config {
              nfs_server_settings

              if [[ "${!zfs_or_mdadm}" == "ZFS" ]]; then
                sudo su -c 'echo "'"/${!zfs_pool_name}/${!zfs_mount_point} ${!nfs_cidr_block}${!nfs_opts}"'" > /etc/exports'
              elif [[ "${!zfs_or_mdadm}" == "mdadm" ]]; then
                sudo su -c 'echo "'"/${!mdadm_raid_fs_name} ${!nfs_cidr_block}${!nfs_opts}"'" > /etc/exports'
              fi
              sudo systemctl enable rpcbind
              sudo systemctl enable nfs-server
              sudo systemctl start rpcbind
              sudo systemctl start nfs-server
              sudo systemctl start rpc-statd
              showmount -e localhost
            }

            function ck_status {

              if [[ "${!zfs_or_mdadm}" == "ZFS" ]]; then
                zfs_status=$(sudo zpool status | grep state | awk {'print $2'})
                sudo mount | grep ${!zfs_pool_name}
                let zfs_mount_rc=$?
                sudo showmount -e localhost | grep -v Export | grep ${!zfs_mount_point}
                let nfs_status_rc=$?
                if [[ "${!zfs_status}" == "ONLINE" ]] && [[ "${!nfs_status_rc}" -eq 0 ]] && [[ "${!zfs_mount_rc}" -eq 0 ]]; then
                  echo "ZFS and NFS installed and configured"
                  curl -X PUT -H 'Content-Type:' --data-binary '{ "Status" : "SUCCESS",  "Reason" : "ZFS and NFS installed and configured",  "UniqueId" : "ZFS001",  "Data" : "ZFS and NFS installed and configured."}'    "${!my_wait_handle}"
                fi
              elif [[ "${!zfs_or_mdadm}" == "mdadm" ]]; then
                mdadm_status=$(sudo mdadm --detail /dev/md0 | grep "State :" | awk {'print $NF'})
                sudo mount | grep ${!mdadm_fs_name}
                let mdadm_mount_rc=$?
                sudo showmount -e localhost | grep -v Export | grep ${!mdadm_fs_name}
                let nfs_status_rc=$?
                if [[ "${!mdadm_status}" == "clean" ]] && [[ "${!nfs_status_rc}" -eq 0 ]] && [[ "${!mdadm_mount_rc}" -eq 0 ]]; then
                  echo "mdadm raid and NFS installed and configured"
                  curl -X PUT -H 'Content-Type:' --data-binary '{ "Status" : "SUCCESS",  "Reason" : "mdadm raid and NFS installed and configured",  "UniqueId" : "ZFS001",  "Data" : "mdadm raid and NFS installed and configured."}'    "${!my_wait_handle}"
                fi
              fi
            }

            declare -A instStore_devs
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



workshops/eda-workshop-soca/templates/nfs_server_instanceStore_zfs_soca.yaml [689:756]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            echo "Done installing ZFS"
          }

          function zfs_create {

            echo "Using these devices for ZFS:"
            sudo nvme list | grep "Amazon Elastic Block Store" | grep -v nvme0n1

            sudo /sbin/modprobe zfs
            modinfo zfs
            sudo zpool create -O compression=lz4 -O atime=off -O sync=disabled -f ${!zfs_pool_name} -o ashift=12 ${!dev_list}
            sudo zpool status -v
            sudo zfs create ${!zfs_pool_name}/${!zfs_mount_point}
          }

          function zfs_startup {
            sudo systemctl enable zfs-import-cache
            sudo systemctl enable zfs-mount.service
            sudo systemctl enable zfs.target
          }

          function nfs_server_settings {
            sudo su -c 'echo -e "STATD_PORT=\"32765\"\nSTATD_OUTGOING_PORT=\"32766\"\nSTATDARG=\"-p 32765 -o 32766\"\nMOUNTD_PORT=\"32767\"\nRPCMOUNTDOPTS=\"-p 32767\"
          LOCKD_UDPPORT=\"32768\"\nLOCKD_TCPPORT=\"32768\"\nRQUOTAD_PORT=\"32769\"\nRQUOTAD=\"no\"\nRPCNFSDCOUNT=\"128\""' > /etc/sysconfig/nfs
          }

          function nfs_config {
            nfs_server_settings

            if [[ "${!zfs_or_mdadm}" == "ZFS" ]]; then
            sudo su -c 'echo "'"/${!zfs_pool_name}/${!zfs_mount_point} ${!nfs_cidr_block}${!nfs_opts}"'" > /etc/exports'
            elif [[ "${!zfs_or_mdadm}" == "mdadm" ]]; then
            sudo su -c 'echo "'"/${!mdadm_raid_fs_name} ${!nfs_cidr_block}${!nfs_opts}"'" > /etc/exports'
            fi
            sudo systemctl enable rpcbind
            sudo systemctl enable nfs-server
            sudo systemctl start rpcbind
            sudo systemctl start nfs-server
            sudo systemctl start rpc-statd
            showmount -e localhost
          }

          function ck_status {

            if [[ "${!zfs_or_mdadm}" == "ZFS" ]]; then
            zfs_status=$(sudo zpool status | grep state | awk {'print $2'})
            sudo mount | grep ${!zfs_pool_name}
            let zfs_mount_rc=$?
            sudo showmount -e localhost | grep -v Export | grep ${!zfs_mount_point}
            let nfs_status_rc=$?
            if [[ "${!zfs_status}" == "ONLINE" ]] && [[ "${!nfs_status_rc}" -eq 0 ]] && [[ "${!zfs_mount_rc}" -eq 0 ]]; then
              echo "ZFS and NFS installed and configured"
              curl -X PUT -H 'Content-Type:' --data-binary '{ "Status" : "SUCCESS",  "Reason" : "ZFS and NFS installed and configured",  "UniqueId" : "ZFS001",  "Data" : "ZFS and NFS installed and configured."}' "${!my_wait_handle}"
            fi
            elif [[ "${!zfs_or_mdadm}" == "mdadm" ]]; then
            mdadm_status=$(sudo mdadm --detail /dev/md0 | grep "State :" | awk {'print $NF'})
            sudo mount | grep ${!mdadm_fs_name}
            let mdadm_mount_rc=$?
            sudo showmount -e localhost | grep -v Export | grep ${!mdadm_fs_name}
            let nfs_status_rc=$?
            if [[ "${!mdadm_status}" == "clean" ]] && [[ "${!nfs_status_rc}" -eq 0 ]] && [[ "${!mdadm_mount_rc}" -eq 0 ]]; then
              echo "mdadm raid and NFS installed and configured"
              curl -X PUT -H 'Content-Type:' --data-binary '{ "Status" : "SUCCESS",  "Reason" : "mdadm raid and NFS installed and configured",  "UniqueId" : "ZFS001",  "Data" : "mdadm raid and NFS installed and configured."}'   "${!my_wait_handle}"
            fi
            fi
          }

          declare -A instStore_devs
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



