0

I usually create remote backup image of my raspberrypi from my macbook by using:

ssh [email protected] "sudo dd if=/dev/mmcblk0 bs=1M” | pv | gzip - | dd of=/Users/USER/Downloads/pibackup.gz

There are drawbacks but It works quite fine and i'm ok with it. Recently i found pishrink and i would like to include it in the aforementioned pipe maybe removing gzip since pishrink can do it itself. So first think i installed pyshrink on my raspberry and then i tried to run something like

ssh [email protected] "sudo dd if=/dev/mmcblk0 bs=1M status=progress | pishrink.sh -az -"| dd of=/Users/USER/Downloads/pibackup.img.gz

But it doesn't work. Does anyone got some suggestion?

  • Note that you don't need `dd` at all. You could just do `ssh [email protected] "sudo cat /dev/mmcblk0 | pv | gzip - > /Users/USER/Downloads/pibackup.gz`. See [dd vs cat -- is dd still relevant these days?](https://unix.stackexchange.com/q/12532) – terdon Oct 04 '20 at 13:45
  • That said, please [edit] your question and tell us _how_ it failed. Did nothing happen? Did you get an error message? Was a file created? What was wrong with the file? "It doesn't work" gives us no information to understand what happened. – terdon Oct 04 '20 at 13:46
  • @terdon Ok i will update the question with the error message. PS is there a " missing in the command you just posted? – Paolo Squadrito Oct 04 '20 at 13:48
  • Yes, sorry. I didn't close the `"`. I just wanted to point out that you don't need `dd` and you probably should avoid it since its syntax makes it very easy to make a horrible mistake. Also, you should probably do the compression on the pi instead of locally. No reason to transfer the uncompressed data over the network. – terdon Oct 04 '20 at 14:08

0 Answers0