As you've mentioned, the whole point of a slave zone is that it transfers the zone data from the master. Editing that file will result in undefined behavior to the best of my knowledge.
The "safe" way to do this would be to change the zone config in your
named.conf on the backup server from being a
slave to being
master, but pointing that master zone to the same zone file (the
file directive) on disk, and commenting out the
You can then alter the zone file as you need and the backup server is now the master for the zone.
Another option is to set both servers to be 'master', and use an out-of-band file sync tool (eg, rsync, unison, syncthing) to keep the zone file on both hosts in sync. If you use a 2-way file sync tool, then changes on either server will sync to the other. You will need to devise a method to have named reload the zone file when changes are made - this could be as simple as reloading on a cron/systemd timer, or using inotify or systemd paths (see
man system.path) to execute the reload whenever the file changes on disk.
An example systemd path could look like this (saved as
Description=Triggers a reload of named zones when zone file changes on disk
You need a corresponding
.service unit to do the actual reload (ie