Skip to content

OpenMediaVault

OpenMediaVault is my NAS that serves both NFS and SAMBA shares to my network. It runs on VM on the system that is directly connected to my external hard drive.

🛠 Installation

Download ISO into Proxmox

pve

(
  cd /var/lib/vz/template/iso && \
  wget $(curl -s https://sourceforge.net/projects/openmediavault/rss?path=/iso | \
  grep -oP '<link>https://sourceforge.net/projects/openmediavault/files/iso/[^<]+</link>' | \
  head -n 1 | \
  sed 's/<link>//; s/<\/link>//'| \
  sed 's/\/download$//')
)

Create new VM

General

Name: omv

Start at boot: ✅

OS

ISO image: *.iso

Disks

Bus/Device: SATA

Disk size (GiB): 16

CPU

Cores: 2

Memory

Memory (MiB): 4096

Look for disk

lsblk

Install omv into VM.

Default Access

Port: 80

Username: admin

Password: openmediavault

🔑 Change Password

Top right person icon -> Change Password

New User

Users -> Users

Groups: openmediavault-admin,users

Reinstall

Recover drive

Mounted after reinstall and not before.

Remount

omv-firstaid

Static IP

GUI

Network -> Interfaces -> ens18

Method: Static

Address: 192.168.2.19

Netmask: 255.255.0.0

Gateway: 192.168.0.0

NFS

Server

Client: 192.168.2.0/24

Permission: Read/Write

Extra options: subtree_check,insecure,no_root_squash

Client

Installation

apt install autofs

/etc/auto.master

echo "/mnt /etc/auto.nfs --ghost --timeout=60" | tee -a /etc/auto.master
+auto.master
/mnt /etc/auto.nfs --ghost --timeout=60

/etc/auto.nfs

echo "storage -fstype=nfs4,rw,insecure 192.168.2.19:/storage" | tee /etc/auto.nfs
storage -fstype=nfs4,rw,insecure 192.168.2.19:/storage

Test

showmount -e 192.168.2.19

Mount

(
  systemctl restart autofs.service && \
  systemctl status autofs.service
)

🔔 NFS Failure Notification Script

A simple utility to send a notification to mailrise on an NFS service failure.

🛠 Installation

task create-nfs-override
sudo bash -c '
mkdir -p /etc/systemd/system/nfs-server.service.d/
cat <<EOF > /etc/systemd/system/nfs-server.service.d/override.conf
[Service]
OnFailure=/root/git/nicholaswilde/homelab/vm/openmediavault/notify-nfs-failure.sh
EOF
mkdir -p /etc/systemd/system/nfs-server.service.d/
/etc/systemd/system/nfs-server.service.d/override.conf
[Service]
OnFailure=/root/git/nicholaswilde/homelab/vm/openmediavault/notify-nfs-failure.sh
homelab/vm/openmediavault/notify-nfs-failure.sh
#!/usr/bin/env bash

################################################################################
#
# notify-nfs-failure
# ----------------
# A simple utility to send a notification to mailrise on an NFS service failure.
#
# @author Nicholas Wilde, 0xb299a622
# @date 06 Jul 22025
# @version 0.1.0
#
################################################################################

set -e
set -o pipefail

# Variables
SMTP_SERVER="smtp://smtp.l.nicholaswilde.io:8025"
TO_ADDRESS="[email protected]"

readonly SMTP_SERVER
readonly NFS_SERVICE
readonly TO_ADDRESS

function set_vars(){
  HOSTNAME=$(hostname)
  UNIT_NAME="%n" # systemd variable for the unit name that failed
}

function send_notification(){
  # NFS service is down, send notification
  MESSAGE="NFS service on $HOSTNAME is DOWN! Check OpenMediaVault immediately."
  TITLE="🚨 OMV NFS DOWN! 🚨"
  TAGS="warning,nfs,omv,down"
  PRIORITY="urgent" # Priority 5 for urgent (highest)

  curl -fsSL \
      --url 'smtp://smtp.l.nicholaswilde.io:8025' \
      --mail-from '[email protected]' \
      --mail-rcpt ${TO_ADDRESS} \
      --upload-file - <<EOF
From: OMV NFS <[email protected]>
To: ${TO_ADDRESS}
Subject: ${TITLE}

${MESSAGE} (Unit: ${UNIT_NAME})
EOF
  # Log to syslog for historical record on the OMV server
  logger -t "notify-nfs-failure" "NFS service on $HOSTNAME is DOWN. Sent notification."
}

function main(){
  set_vars
  send_notification
}

main "@"

WIP

🚀 Upgrade

Code

task upgrade
omv-upgrade

Task List

task: Available tasks for this project:
* create-nfs-override:       Creates or updates the systemd override file for nfs-server.service
* decrypt:                   Decrypt .env using SOPS
* enable:                    Enable service
* encrypt:                   Encrypt .env using SOPS
* export:                    Export the task list
* id-nfs-service:            Identify NFS service
* init:                      Init
* mklinks:                   Make client symlinks
* restart:                   Resart service
* start:                     Start service
* status:                    Service status
* stop:                      Stop service
* update:                    Update vm
* upgrade:                   Upgrade app

🔗 References