0

pseudo code below, but how to do it? I dont have space to save dd image locally....

$ sudo dd if=/dev/sda of=/scp -P 12344 potato@10.10.45.44:/volume2/share02/01.dd

I don't know how to execute it or wrap it locally to go around low storage on the system that I try to dd image.

1 Answers1

0

If you can scp, you probably can run cat after you ssh.

sudo dd if=/dev/sda bs=4M | ssh -p 12344 potato@10.10.45.44 'cat > /volume2/share02/01.dd'

This may be troublesome if sudo and ssh both ask for your passwords. In this case make this sudo invocation run without password (sudo true just before may suffice); or sudo su - beforehand, so you're root and don't need sudo before dd; or make ssh not require password (use key-based authentication).

dd writes to its stdout, ssh takes it and passes to the remote cat, its output is redirected to /volume2/share02/01.dd.

Notes:

  • While reading /dev/sda with dd it's good to use bs= larger than the default, e.g. bs=4M.
  • I would use dd status=progress … or pv instead of dd (or at least between dd and ssh: dd … | pv | ssh …) to see the progress.
  • Remember sda must not be written to while dd works. E.g. mounted sda1 (unless read-only) may make the image inconsistent.
  • You can reduce the size of the image. Read this answer of mine. In your case, after you prepare the whole sda, the command may be

    pv /dev/sda | gzip -c -9 | ssh -p 12344 potato@10.10.45.44 'cat > /volume2/share02/01.dd.gz'