so I've got an iso that I created and it is roughly 197gb. I compressed the file into an iso.gz and saved it to my local machine. I now would like to try to deploying this iso to a remote box. now for the more detailed portions:

I am using a live RHEL 7.5 USB that is plugged into the remote box, and I issue the following command to view the disks currently mounted on the system:

Fdisk -l 

which returns to me that the desired drive (my 1tb destination drive) is /dev/sda

I have tried the following command with no luck, and i'm not sure if this is the correct sequence or if it is even possible to zcat remotely:

zcat myisoname.iso.gz | ssh root@xxx.xxx.xxx.xxx | /dev/sda

when issuing the above zcat command the console freezes for a moment and then starts printing out random letters and symbols. Any help would be greatly appreciated.

  • 1
    I think the second pipe is happening on your local machine. You should quote the remote command. Something like zcat myisoname.iso.gz | ssh root@xxx.xxx.xxx.xxx 'dd of=/dev/sda' should work. – fra-san Oct 30 '18 at 15:32
  • I see, and usually with zcat when doing it locally you need to use redirection ">" would I need to use this instead of the 'dd of=/dev/sda'? or in this case I suppose the dd command just directs the output? – RickwhoPrograms Oct 30 '18 at 15:48
  • 1
    I think that ssh root@xxx.xxx.xxx.xxx 'cat - >/dev/sda' will work too. – fra-san Oct 30 '18 at 15:55
  • Thanks for your help @fra-san, if you want go ahead and post your comment as an answer and I will accept it, the culprit was the quotation marks it looks like! – RickwhoPrograms Oct 31 '18 at 17:51
  • I don't really like answering after a problem has been solved in comments - it looks like just searching for reputation - but... actually comments will ultimately fade away, and an accepted answer will help others in better understanding the question. – fra-san Oct 31 '18 at 18:32

In principle, what you are trying to do is completely plausible.
The issue with your command is that the second pipe is happening on your local machine. Commands that are arguments to ssh should be quoted.

(Specific attention has to be paid to special characters like $: if expansion and/or command substitution have to happen remotely, those special characters has to be escaped or, alternatively, the remote command wrapped in single quotes. See, for reference, the QUOTING section in man bash).

What you probably need is something like

$ zcat myisoname.iso.gz | ssh root@xxx.xxx.xxx.xxx 'dd of=/dev/sda'

Here, dd is just a possibility. You should be able to use a pipe to file too, as in

$ ssh root@xxx.xxx.xxx.xxx 'cat - >/dev/sda'

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.