Worthy of note (IMO), and useful if you’re trying to avoid using NFS to drop a mksysb on for security reasons.
Create a “bckup” userid on both the server you want to perform the mksysb on (target) and the server you want to backup to (source). Then ensure you can authenticate from target to source using public-key authentication (and a blank pass-phrase to avoid password prompts or using ssh-agent).
Ensure the bckup user on the source has permissions to write to the backup area (file system), and the ulimit is set to allow big enough files can be written.
On the target, this simple code will work on it’s own, but of course you may want to add alerting/error-checking and the like, or even look at running this on the source server in a slightly different way to allow backup of several targets using just the one script.
mkfifo /tmp/pipe.$$ sudo mksysb -ievX /tmp/pipe.$$ & dd if=/tmp/pipe.$$ | ssh remote-server dd of=/backup/`hostname`.$$.mksysb
Delete the /tmp/pipe.$$ file when done (or add some code to check the mksysb process has completed before deleting it within the script).
WARNING : Big Al pointed out that you shouldn’t try and stream to a remote tape device though using this method.