So you always have fresh mirrors, setup reflector.
pacman-Sreflector
Create service to select the 200 most recently synchronized HTTP or HTTPS mirrors, sort them by download speed, and overwrite the file /etc/pacman.d/mirrorlist.
# msmtp system wide configuration file# A system wide configuration file with default account.defaults# The SMTP smarthost.hostsmtp.fastmail.comport465# Construct envelope-from addresses of the form "user@oursite.example".#auto_from onmaildomain<yourdomain># Use TLS.tlsontls_starttlsoff# Activate server certificate verificationtls_trust_file/etc/ssl/certs/ca-certificates.crt# Syslog logging with facility LOG_MAIL instead of the default LOG_USER.syslogLOG_MAILaliases/etc/aliases# msmtp root account, inherit from 'default' accountaccountdefaultuser<youremail>fromsystem@<yourdomain># Terrible...# auth plain# password <pass># or with passwordeval,# passwordeval "gpg --quiet --for-your-eyes-only --no-tty --decrypt ~/.msmtp-root.gpg"accountroot:default# password, see below
Set permissions.
chmod600/etc/msmtprc
You can setup a gpg encrypted passphrase if using interactively. The other (not very good option) is setting with 'password' in config.
Add aliases to /etc/aliases.
root:root@<yourdomain>
If anything private is in /etc/msmtprc, secure the file as shown on the Arch wiki.
Create an ssmtp group and set the owner of /etc/msmtp and the msmtp binary.
Set all datasets to snapshot and disable any datasets that dont require snapshotting.
for ds in $(zfslist-H-oname); do MP="$(zfsget-H-ovaluemountpoint $ds )";if [ ${MP} =="legacy" ] || [ "${MP}"=="/" ]; thenecho"${ds}: on";zfssetcom.sun:auto-snapshot=true ${ds};elseecho"${ds}: off";zfssetcom.sun:auto-snapshot=false ${ds};fi;done
In one line:
for ds in $(zfslist-H-oname); do MP="$(zfsget-H-ovaluemountpoint $ds )"; if [ ${MP} =="legacy" ] || [ "${MP}"=="/" ]; thenecho"${ds}: on"; zfssetcom.sun:auto-snapshot=true ${ds}; elseecho"${ds}: off";zfssetcom.sun:auto-snapshot=false ${ds}; fi; done
ZFS Replication With ZnapZend
Install ZnapZend (AUR) (it's a great tool, I maintain the AUR package).
pacaur-Sznapzendsystemctlenable--nowznapzend
Create a config for each dataset thet needs replicating, where SYSTEM will be a name for the dataset at ${POOL}/replication/${SYSTEM} on the remote. Specify the remote user and IP as well. Here is a small script I use for my setup. The grep can be adjusted to exclude any datasets that are unwanted.
#!/bin/shREMOTE_POOL_ROOT="${1}"REMOTE_USER="${2}"REMOTE_IP="${3}"for ds in $(zfslist-H-oname| \grep-E'data/|default|john|usr/|var/|lib/'| \grep-vcache); doecho"Creating: ${REMOTE_USER}@${REMOTE_IP}:${REMOTE_POOL_ROOT}/${ds}"# See ssh(1) for -tt# https://www.freebsd.org/cgi/man.cgi?query=ssh# In simple terms, force pseudo-terminal and pseudo ttyssh-tt ${REMOTE_USER}@${REMOTE_IP} \"~/znap_check_dataset ${REMOTE_POOL_ROOT}/${ds}"znapzendzetupcreate--tsformat='%Y-%m-%d-%H%M%S' \SRC'1d=>15min,7d=>1h,30d=>4h,90d=>1d' ${ds} \DST:${REMOTE_IP} '1d=>15min,7d=>1h,30d=>4h,90d=>1d,1y=>1w,10y=>1month' \"${REMOTE_USER}@${REMOTE_IP}:${REMOTE_POOL_ROOT}/${ds}"done
On remote I have a pre-znazendzetup script which makes sure the remote location exists.
#!/bin/sh# Pre zapzendzetup script. Put in ~/znap_check_dataset on remote and run withds="${1}"if [ "$(zfslist-H-oname "${ds}")"="${ds}" ]; thenecho"${ds} exists, running ZnapZend."elseecho"Creating non-existant dataset ${ds}"zfscreate-p"${ds}"zfsunmount"${ds}"echo"${ds} created, running ZnapZend."fi
I would then run, for chin on replicator@<server ip>.
Long or short tests can be run on a disk. A short test will check for device problems. The long test is just a short test plus complete disc surface examination.
To test if your mail notification is working run a test, add -m <email address> -M test to the end of the config. This will run the test on the start of the daemon.: