OpenMediaVault-Plugin-Developers / openmediavault-zfs

OpenMediaVault plugin for zfs
74 stars 15 forks source link

how to update config.xml with mounts made manually? #81

Closed stevekuznetsov closed 2 years ago

stevekuznetsov commented 2 years ago

The openmediavault-zfs 5.0.6 package does not include the web UI. When using zpool manually to create pools, though, no entries are made for these in /etc/openmediavault/config.xml. My file has no entries in config.system.fstab. omv-salt deploy run fstab exists to update /etc/fstab, but I can't find any way to import the ZFS filesystem I've created into the configuration file. What is the process here?

stevekuznetsov commented 2 years ago

This looks like the relevant code:

https://github.com/OpenMediaVault-Plugin-Developers/openmediavault-zfs/blob/15f2617da7e8047cf4bbc9c455bddcd2994f56b7/usr/share/omvzfs/Utils.php#L206-L218

ryecoaaron commented 2 years ago

That function is executed any time you view the plugin’s tree view and should import yiur manually created pools/etc.

stevekuznetsov commented 2 years ago

@ryecoaaron how do I "view the plugin's tree view"? The 5.0.6 release removed the UI ...

I wrote this script:

#!/bin/bash

set -o nounset
set -o errexit
set -o pipefail

pool="${1:-""}"

if [[ -z "${pool:-}" ]]; then
  echo "USAGE: ${0} <pool>"
  exit 1
fi

mountpoint="$( zfs list -p -H -o mountpoint -t filesystem "${pool}" )"

xmlstarlet ed --inplace \
    --subnode /config/system/fstab --type elem --name mntentTMP --value "" \
    --subnode /config/system/fstab/mntentTMP --type elem --name uuid   --value "$( uuid )" \
    --subnode /config/system/fstab/mntentTMP --type elem --name fsname --value "${pool}" \
    --subnode /config/system/fstab/mntentTMP --type elem --name dir    --value "${mountpoint}" \
    --subnode /config/system/fstab/mntentTMP --type elem --name type   --value "zfs" \
    --subnode /config/system/fstab/mntentTMP --type elem --name opts   --value "rw,relatime,xattr,noacl" \
    --subnode /config/system/fstab/mntentTMP --type elem --name freq   --value "0" \
    --subnode /config/system/fstab/mntentTMP --type elem --name passno --value "0" \
    --subnode /config/system/fstab/mntentTMP --type elem --name hidden --value "0" \
    --rename  /config/system/fstab/mntentTMP --value mntent /etc/openmediavault/config.xml

After running it, I now have a ZFS plugin UI view (lol) and everything works as expected.

stevekuznetsov commented 2 years ago

Just to make it clear - before I added that XML manually, under "storage" no ZFS entry existed in the web UI. Now:

Screenshot from 2022-05-08 11-25-29

ryecoaaron commented 2 years ago

The plugin was not installed correctly it you didnt see a gui.

ryecoaaron commented 2 years ago

The 5.x version never removed the web interface. Even the 6.x version only had it missing for a very short time.

stevekuznetsov commented 2 years ago

Bizarre. I just followed the directions to install using the web UI.

ryecoaaron commented 2 years ago

I would've just tried: sudo apt-get install --reinstall openmediavault-zfs