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 changezfs-after— hook: sets quotas and destroys a deleted home’s dataset after the changezfs-home-convert— converts existing plain-directory homes to datasets, and checks the layout with--checkzfs-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
- 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 - If the server already has homes, convert them first (see readme.md). At
minimum,
rpool/homemust havemountpoint=/home. The before-hook refuses to create anything until it does, and running the converter sets that up. - 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
- Command to run before making changes to a server:
- 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.
- Edit the settings at the top of
zfs-home-lib.pland change any that don’t match your server:$pool— pool name (defaultrpool)$base— the dataset that maps to/home(defaultrpool/home)$zfs— path to thezfscommand (default/usr/sbin/zfs)$qtype—quotacounts snapshots and child datasets;refquotadoesn’t$verbose— print each step in Virtualmin’s output (default on)$logfile— set to e.g./var/log/zfs-home-hooks.logto log every hook run (default off)$default_user_quota— quota in KB for new users (default0, 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.