Expanding ZFS pool online

At work I’m setting up a new syslog server and wanted the logs to be stored raw on disk (that is not compressed using gzip). To do that I created a ZFS pool with compression enabled allowing for transparent compression. First I created a zpool with a single disk (this is a VM so no redundancy is needed): # Create a pool with the name 'zlog' zpool create zlog /dev/sdb # Enable compression zfs set compression=on zlog # Set the mountpoint mkdir /logs zfs set mountpoint=/logs logpool This results in a mounted zfs volume: ...

August 30, 2022

Configuring systemd user timer

To run systemd timer jobs (cron) as a user you’ll need to create a systemd service folder as the user: mkdir -p ~/.config/systemd/user/ By default, systemd will only run timers if the user is logged in so to be able to run timer jobs without logged in use we enable lingering session with loginctl enable-linger username Then you can drop the .service and .timer files in the ~/.config/systemd/user folder. To pick up the job you’ll need to run (as the user) ...

June 27, 2020

haproxy: Monitor PostgreSQL for current master

There are couple of methods for haproxy to monitor what PostgreSQL instance is currently master so that “dumb” clients can always write to a PostgreSQL instance (instead of connecting to the standby node). First there is the send-binary method by replicating the PostgreSQL V3 protocol but requires trusted connection and is TCP/IP only (no SSL). Another issue is that haproxy terminates the connection dirty when connecting to standby instances. Another method is letting haproxy call xinetd service that runs script to check if the current node is the master. ...

September 24, 2019

vlan bridges in netplan

Took me a while to figure this one out in the netplan yaml syntax: network: version: 2 renderer: networkd ethernets: eno1: dhcp4: no dhcp6: no bridges: br20: dhcp4: no dhcp6: no interfaces: [ vlan20 ] addresses: [ 192.168.20.5/24 ] gateway4: 192.168.20.1 nameservers: addresses: - "192.168.20.1" br40: dhcp4: no dhcp6: no interfaces: [ vlan40 ] vlans: vlan20: id: 20 link: eno1 dhcp4: no dhcp6: no vlan40: id: 40 link: eno1 dhcp4: no dhcp6: no Bonus .vimrc settings for yaml ...

March 21, 2019

Pipe cron to syslog/journald

Simple way to pipe cron script output to journalctl / syslog MAILTO="" * * * * * user (echo "testing") 2>&1 | logger -t tag-to-use gives following in journalctl $ journalctl SYSLOG_IDENTIFIER=tag-to-use -- Logs begin at Tue 2019-02-26 16:48:53 UTC, end at Fri 2019-03-08 22:12:03 UTC. -- Mar 08 22:04:01 server tag-to-use[25769]: testing

March 9, 2019