To restore a .gz image file located on 192.168.0.1 to a target device on 192.168.0.2 using dd and ssh, you can use the following command:
Ensure Connectivity and Permissions:
Ensure you can SSH from 192.168.0.2 to 192.168.0.1.
Ensure the user has read permissions for the image file on 192.168.0.1 and write permissions to the target disk on 192.168.0.2.
Identify the Image File Path and Target Device:
Identify the path of the compressed image file on 192.168.0.1.
Determine the target disk or partition on 192.168.0.2 (e.g., /dev/sda).
Example Command to Execute from 192.168.0.2
Assume the image file is located at /home/user/backup.img.gz on 192.168.0.1 and the target device is /dev/sda on 192.168.0.2.
Run the Command on 192.168.0.2:
ssh [email protected] “gzip -dc /home/user/backup.img.gz” | sudo dd of=/dev/sda bs=4M status=progress
I am skeptical about the command because I thought once I ssh into ..0.1 it will overwrite the /dev/sda on ..0.1 instead of ..0.2
Can someone help confir this.