You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu 16.04环境下如何配置ZFS ZED使用容器内Postfix邮件服务器

Configuring ZFS ZED to Use Your LXD-Hosted Postfix Server (Port 1478) on Ubuntu 16.04

Got it, let's walk through getting ZFS ZED (ZFS Event Daemon) to send disk failure alerts via your Postfix server running in an LXD container. Here's a step-by-step guide tailored to your setup:

1. Ensure ZFS ZED is Installed

First, confirm the ZED package is installed on your Ubuntu 16.04 host. If not, install it with:

sudo apt update && sudo apt install zfs-zed

2. Get Your Postfix Container's IP Address

You'll need the internal IP of your LXD container to point ZED to it. Run this command to list your containers and their IPs:

lxc list

Note down the IP (e.g., 10.0.3.10) for your Postfix container.

3. Edit the ZED Configuration File

ZED's main config is located at /etc/zfs/zed.d/zed.rc. Open it in your favorite editor:

sudo nano /etc/zfs/zed.d/zed.rc

Update these key variables to match your setup:

  • Set alert recipients: Replace with the email address where you want to receive ZFS alerts:
    ZED_EMAIL_ADDR="your-alert-recipient@example.com"
    
  • Set the sender address: This will be the "from" address on alert emails:
    ZED_EMAIL_FROM="zfs-alerts@your-domain.com"
    
  • Point to your Postfix container: Override the default email program to send directly to your container's port 1478. Use either of these options:
    Option 1: Use sendmail with a custom server/port (simple, no extra packages):
    ZED_EMAIL_PROG="sendmail -S [YOUR_CONTAINER_IP]:1478"
    
    Option 2: Use ssmtp (more configurable, requires installing the package first):
    1. Install ssmtp:
      sudo apt install ssmtp
      
    2. Edit /etc/ssmtp/ssmtp.conf to point to your container:
      root=zfs-alerts@your-domain.com
      mailhub=[YOUR_CONTAINER_IP]:1478
      FromLineOverride=YES
      
    3. Update ZED's email program to use ssmtp:
      ZED_EMAIL_PROG="ssmtp"
      
  • Enable verbose alerts (optional but recommended for disk failure notifications):
    ZED_NOTIFY_VERBOSE=1
    

Save and close the file when you're done.

4. Start and Enable the ZED Service

Make sure ZED runs on boot and starts immediately:

sudo systemctl enable zed
sudo systemctl start zed

5. Test the Setup

To verify everything works, trigger a ZFS event (like starting a scrub on a pool) and check if you receive an alert email:

zpool scrub [YOUR_ZFS_POOL_NAME]

You can also check ZED's logs for any errors:

tail -f /var/log/zfs/zed.log

Important Notes

  • Network Access: Ensure your Ubuntu host can reach the Postfix container's 1478 port. Check LXD's network settings (e.g., container profile firewall rules) if you run into connectivity issues.
  • Postfix Configuration: Double-check your container's Postfix setup allows incoming mail from the host IP, and that it's configured to relay emails to your external recipient if needed.

内容的提问来源于stack exchange,提问作者OmerSakar

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 10:33:12