How Do I Copy My Disk Over SSH To Windows?
I have a Linode and I want to follow this Copying a Disk Over SSH guide to create a local .img file on my local Windows machine. How do I do this?
4 Replies
There are a few things to consider with this question. First, Windows by default does not have SSH installed. It also by default does not have dd
installed either. The first thing you will need to do is make sure you have PuTTY installed so you can SSH on Windows. To make sure you can use dd
properly, you will want to install dd for Windows.
Assuming you have already installed Putty and have booted the Linode into rescue mode and enabled SSH on the Linode, here are the steps I took to copy my disk over SSH to my Windows machine:
- Download
dd
for Windows http://www.chrysocome.net/dd - Unzip the most recent binary file then copy the
dd.exe
file to a recognized Path. On my Windows machine that was underC:\Users\Admin\AppData\Local\Microsoft\WindowsApps
- Create a local folder under
C:\
calledLinode
- Open up the command line in Windows
- From that Windows command line run
ssh root@$IP_ADDRESS "dd if=/dev/sda " | dd of=C:\Linode\linode.img
To find the recognized Path for your Windows machine, click the Start button then right click This PC. Choose Properties. From there, click Advanced System Settings. Click the Environment Variables button, and in the new pane look for the entry labeled Path. This is the folder you will want to drop dd.exe
in.
Following those above steps, you should be able to copy your remote disk to your Windows machine using SSH and dd.
Windows 10 has a built in SSH client
https://docs.microsoft.com/en-us/windows/terminal/tutorials/ssh
@scrane, thank you for the guide.
I tried it using the recent 64 bit version of this dd for windows but it doesn't work, as I get an error of "bash: line 1: ddrelease64.exe: command not found", I guess because that file, the 64 bit version of dd, is located on my windows while the ssh session runs on the linux, so obviously it cannot find it.
Any idea what can I do?
Linode support also came across the same issue I did.
Anyway, what I eventually did is to use Orcale Virtualbox, use a Ubuntu VM I had in it.
I created a virtual disk larger than the size of the drive I wished to copy to my Windows, attached that drive to the Ubuntu VM, booted that VM, and then mounted the new disk to a mount point and then run the command mentioned in the first link from above (with of course needed changes regarding the local of value) and all worked well (because it is linux to linux), except the slow download speed from Linode…
FYI.