Stream mksysb over SSH

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.

About

I'm a freelance UNIX engineer working in the UK. I'm married to Tina and between us we have six children. I'm a bit of an Apple fan boy, and all the Windows machines in the house are a thing of the past now.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: