berth

Server management

Disks, snapshots and the machine

Watch disk space and inodes with a forecast, free up space with fixed safe actions, check SMART, RAID and ZFS health, add data disks as an LVM pool, take snapshots on LVM-thin, btrfs, ZFS or Proxmox, enforce disk quotas, and keep time, hostname and memory in order.

Updated 9 min readdisk · storage · snapshot · lvm · zfs · quota · smartView as Markdown

On this page
  1. Disk space and inodes
  2. Freeing up space
  3. Growing and mounting disks
  4. Disk health: SMART, RAID, ZFS, btrfs and thin pools
  5. Your own data disks: the storage pool
  6. Snapshots
  7. Disk quotas
  8. Time, hostname and network
  9. Memory, swap and OOM
  10. Related

A full disk is still the most common way for a hosting server to fall over: MariaDB stops, mail is deferred, backups fail. This article covers the Machine group of Berth's server management: disks and their health, extra data disks, snapshots, disk quotas per subscription, and the time, network and memory settings a busy server depends on.

Disk space and inodes

System → Disks shows every file system with its space as df would, the number of files (inodes), whether it is mounted read-only, and how fast usage is changing. The column Full in is the forecast: a straight line through the last one to two weeks of measurements, shown only when the trend is reliable. The 5 % that most file systems reserve for root is counted as used, because services do not run as root and see the disk as full once only that reserve is left.

Notices:

  • when a file system or its inodes pass the percentage you set (berth notify set --disk-percent 90 --inode-percent 90),
  • when the forecast says it will be full soon (Disk filling up (forecast)),
  • when a disk is full and MariaDB or the mail server have stopped, the watchdog reports it through its emergency route, independent of the database. See notifications and alerts.
berth system disks
berth stats forecast --text
berth system disk-top --mount /var --fresh     # where the space is: system directories and per subscription

Freeing up space

Disks → Free up space first shows where the space is: the largest system directories and the usage per subscription (summarised per subscription, never with customers' file names). Then it offers a fixed list of clean-up actions. There are no free-form paths; the agent only knows these actions:

ActionWhat it removes
journal_vacuumold journal files; active ones stay
package_cachedownloaded packages
rotated_logsrotated log files
coredumpscrash dumps
php_sessionsexpired PHP session files, without following symlinks
podman_prunecontainer images without a name, optionally for one subscription
old_kernelsold kernels, keeping the running one, the newest and one spare

Always run the Dry run first: it measures what each action would gain and changes nothing. The real clean-up runs as a system job with a log. Everything except old kernels counts as safe.

The policy decides what the panel does when a disk gets full: off (only the notice), suggest (a dry run is attached to the notice; you clean up) or auto (from a percentage you choose, the panel runs the safe actions itself after a dry run). Kernels are never removed automatically.

berth system disk-cleanup --safe --dry-run
berth system disk-cleanup --actions journal_vacuum,rotated_logs
berth system disk-policy --mode suggest

Growing and mounting disks

Disks → Grow and mount shows what can grow after you enlarged a virtual disk, and devices that can be mounted. It grows the partition and file system (also on LVM), formats and mounts an empty device at an empty directory, and sets mount options such as nosuid,nodev,noexec for /tmp, /var/tmp and /dev/shm. Every change has a dry run.

berth system disk-manage --grow / --dry-run
berth system disk-manage --mount /dev/vdb --at /srv/data --fstype xfs --dry-run
berth system disk-manage --tmp /tmp --options nosuid,nodev

Disk health: SMART, RAID, ZFS, btrfs and thin pools

System → Hardware checks:

  • SMART and NVMe: health, wear, power-on hours and temperature (smartmontools is installed on request),
  • RAID: a degraded md array has lost a disk,
  • ZFS pools: health, errors, fill level and the last scrub,
  • btrfs: errors per device,
  • LVM-thin pools: data and metadata usage, because a full thin pool damages the volumes inside it,
  • temperature sensors.

On a virtual machine the hardware belongs to the host: SMART and temperature are skipped, and the page reports steal instead, the time the host takes away from the VM. A new finding produces one notice (a failure is critical and goes out outside office hours too), and one message when everything is fine again.

berth system hardware --refresh

Your own data disks: the storage pool

On a server with extra disks you can keep the system disk for the operating system and put customer data on its own storage. Disks → Storage shows all disks, the pool and, per disk, what is stored there: websites, mail, databases, backups and containers.

  • The pool is an LVM volume group of empty disks with one XFS file system (with project quotas) on top. Berth only uses disks on which wipefs finds nothing, and checks that again just before writing. Disks can be added while everything runs; a disk can be removed if the others have room (pvmove); a broken or too small disk can be replaced online by an empty one.
  • Mirroring (LVM raid1) keeps each copy on a different disk. A degraded mirror is a critical notice, and Replace… rebuilds the missing copy on an empty disk.
  • Without a mirror the page warns that losing one disk loses the pool. Moving data onto an unmirrored pool requires a recent successful external backup, or, on a VM, your explicit statement that the hypervisor already mirrors the disks.
  • Moving data: per type (websites, mail, MariaDB, PostgreSQL, backups and history, containers) to the pool, to a volume Berth mounted, or back to the default. The paths stay the same through bind mounts. Berth first copies while everything runs, then takes a short maintenance window to stop the affected services, copy the last changes, switch the mount and start them again, followed by a diagnosis. If anything fails inside the window, everything goes back to the old location. The dry run gives size, duration and the expected interruption.

Moving, removing, replacing and switching mirroring off require a typed confirmation and, with four-eyes enabled, a second administrator; see audit trail and approvals. Services get RequiresMountsFor= on their data: if the server boots without the pool, nginx, PHP, mail and the databases do not start (rather than writing into an empty directory on the system disk), while SSH and the panel do.

berth storage status
berth storage pool create --devices /dev/vdb,/dev/vdc --mirror --dry-run
berth storage move mail --to pool --dry-run
berth storage pool replace --device /dev/vdb --new /dev/vdd --dry-run

Snapshots

A snapshot is the quick way back before a risky change. Berth uses them before updates (if enabled in the update policy), before removing components and before a release upgrade. System → Snapshots chooses the provider:

  • Proxmox VE: a snapshot of the whole VM, and rolling back from the panel. Berth links only its own VM: it verifies that the VM is this server (by SMBIOS UUID or MAC address), pins the Proxmox certificate by fingerprint or your own CA, stores the API token sealed, and refuses a token that could delete or take over the VM unless you explicitly accept that. LXC containers are supported too.
  • The server itself: snapshots of the volumes on LVM-thin, btrfs or ZFS. Rolling back is only offered where it is safe; an LVM-thin volume that is in use is rolled back at the next boot (--at-boot).

The policy sets how many of Berth's own snapshots to keep (1 to 10); older ones are removed after a new one. Snapshots you made yourself in Proxmox are shown but never touched.

berth snapshot proxmox --url https://pve.example.nl:8006 --token-id berth@pve!snap \
  --secret-file - --node pve1 --vmid 101 --fingerprint AA:BB:…
berth snapshot proxmox --check          # are the token's privileges no broader than needed?
berth snapshot policy --provider auto --keep 3 --before-updates on
berth snapshot create --label "before PHP 8.4"
berth snapshot list
berth snapshot rollback <name> --yes

A snapshot is not a backup: it lives on the same storage. For that, see backups.

Disk quotas

The disk space in a package becomes a real limit of the file system under System → Disks → Disk quotas, so one customer or one hijacked site cannot fill the server's disk.

  • Project quota limits a subscription's web space, mail and databases together. Uid quota only limits what the system user writes itself (the web space).
  • Switch on runs as a system job after a dry run. Berth never remounts a file system by itself: if a mount or boot option is needed, quotas take effect after the next reboot, which you schedule.
  • Where the file system offers no usable quota, Berth measures usage every hour and warns as the limit comes close, but does not block writes.
  • At the limit, new files, uploads and incoming mail for that subscription are refused. Databases and container storage outside the file system quota are measured separately and locked or stopped above the hard limit of the package.
  • The package also limits the number of files and folders (inodes).
  • Space that falls outside the quota is capped as well: a domain's logs, and a subscription's files in the shared temporary directories (/tmp, /var/tmp, /dev/shm). Berth checks this every minute; berth quota shared runs the check by hand. Each subscription's own /tmp lives inside its webspace and counts towards its quota; see isolation.
berth quota status
berth quota enable --dry-run
berth quota show acme_nl

See customers and packages and isolation for how packages set the limit.

Time, hostname and network

System → Time and network:

  • Clock: time zone, synchronisation, and your own time servers, optionally secured with NTS (Network Time Security, RFC 8915). Berth measures the drift itself with SNTP instead of trusting the time service's own report; a clock that drifts too far breaks TOTP codes, DNSSEC and certificates, so the monitor repairs it and notifies you.
  • Hostname: the server's own name with checks that its A, AAAA and PTR records match. Changing it sets the name everywhere it is used (hostnamectl, /etc/hosts, /etc/mailname) and can set the mail server up again under the new name. The reverse (PTR) record belongs to the owner of the IP address, usually your hosting provider.
  • VPN: the state of Tailscale or WireGuard, through which administrators reach SSH and the admin tools.
  • Network diagnosis from the server: DNS, ping, trace, a TCP port, the certificate a service presents, and an SMTP handshake (nothing is sent). The DNS self-test checks the local resolver, DNSSEC and resolv.conf.
berth system time
berth system time set --servers time.example.nl,ntp.example.nl --nts
berth system hostname
berth system hostname --set srv1.example.nl --mail --dry-run
berth system net-diag smtp mx.example.nl --port 25
berth system dns --repair

Memory, swap and OOM

System → Memory and kernel manages a swap file, zram (compressed swap in memory, used first) or both, vm.swappiness, and kernel parameters for busy servers: presets for many connections, file watchers, containers and databases, plus your own values from an allowed list. Every value is read back and differences are shown.

When the kernel kills a process for lack of memory, Berth records it. Administrators see OOM kills next to disk errors, crashes and unexpected reboots under System → Events; customers see their own under Applications → Memory problems.

Berth also warns before it gets that far: when the server spends a sustained share of its time waiting for memory, administrators get a notice, and a critical one when it gets worse.

berth system swap --zram on --zram-percent 50 --swappiness 10
berth system sysctl --preset connections --on
berth system events list --kind oom,cgroup_oom --period 30d