Vertigan

Made with autism, so you know it's good

ZFS add-ons beta release

Add-on scripts to support ZFS file systems in Webmin and Virtualmin.

Scripts

  • zfs-before — hook: creates and renames a home’s dataset before Virtualmin or Webmin makes a change
  • zfs-after — hook: sets quotas and destroys a deleted home’s dataset after the change
  • zfs-home-convert — converts existing plain-directory homes to datasets, and checks the layout with --check
  • zfs-home-lib.pl — settings and shared code; the other scripts need it in the same directory

Download

zscripts.tar.gz — all four scripts and readme.md.

Installing

  1. Put all the files in one directory, e.g. /root/zscripts/, and make the scripts executable: chmod 700 /root/zscripts/zfs-before /root/zscripts/zfs-after /root/zscripts/zfs-home-convert
  2. If the server already has homes, convert them first (see readme.md). At minimum, rpool/home must have mountpoint=/home. The before-hook refuses to create anything until it does, and running the converter sets that up.
  3. In Virtualmin → System Settings → Virtualmin Configuration → Actions upon server and user creation, set:
    • Command to run before making changes to a server: /root/zscripts/zfs-before
    • Command to run after making changes to a server: /root/zscripts/zfs-after
  4. In Webmin → System → Users and Groups → Module Config, set the commands to run before and after making changes to the same two scripts. Virtualmin creates mailbox users through this module, so this is what gives mailboxes their datasets.
  5. Edit the settings at the top of zfs-home-lib.pl and change any that don’t match your server:
    • $pool — pool name (default rpool)
    • $base — the dataset that maps to /home (default rpool/home)
    • $zfs — path to the zfs command (default /usr/sbin/zfs)
    • $qtype — quota counts snapshots and child datasets; refquota doesn’t
    • $verbose — print each step in Virtualmin’s output (default on)
    • $logfile — set to e.g. /var/log/zfs-home-hooks.log to log every hook run (default off)
    • $default_user_quota — quota in KB for new users (default 0, none). Webmin can’t read quotas on ZFS, so set this only if you add users in Webmin without Virtualmin.

Further Reading

zfs-readme.md — how the dataset layout works, what the hooks do for each event, converting an existing server (including stopping services and finding open files), checking the layout, and troubleshooting.

← Back to Webmin