Is it possible to dd a file from within a VM to a physical disk on the host?

Goi

Diamond Member
Oct 10, 1999
6,766
7
91
I'm trying to clone a physical external hard drive from drive A (external USB) to B (SATA). Drives A and B are both 2TB large. I have a host Windows 10 PC with a Linux VM, which I am running the dd command so as to get a byte for byte clone.

I am first cloning from drive A (which shows up as /dev/sdb on the Linux VM, into an image file on the VMware shared folder on the host drive, using dd.

Next, I wish to dd the image file onto a drive B, which is a physical disk connected to the host SATA port, so it doesn't show use in the /dev file system in the guest Linux VM. Shared folders won't work since drive B is unpartitioned. Short of connecting drive B as an external USB drive, is there any way to access it from the Linux VM to dd the image file to it?
 

Ken g6

Programming Moderator, Elite Member
Moderator
Dec 11, 1999
16,419
4,187
75
I learned the hard way that, at least in Windows XP, Cygwin's /dev drives will write to the physical disk. So you could try dd there.

This shows how to identify your drive and makes me think it would work to write to it.
 

XavierMace

Diamond Member
Apr 20, 2013
4,307
450
126
If all you're trying to do is get a sector by sector clone, why are you jumping through the hoops of using a Linux VM and trying to pass through the physical disks to it?
 

Goi

Diamond Member
Oct 10, 1999
6,766
7
91
If all you're trying to do is get a sector by sector clone, why are you jumping through the hoops of using a Linux VM and trying to pass through the physical disks to it?
I know Linux dd does a byte for byte clone (including free space) without any compression/decompression, but I don't have any Linux machines, only a Linux VM, hence this is 1 way I thought of doing it. Do you have any other alternatives to suggest?
 

XavierMace

Diamond Member
Apr 20, 2013
4,307
450
126
Full disk cloning isn't specific to Linux. There's a variety of Windows based utilities as well as hardware devices that will do it. If you're really set on using Linux, make a bootable USB drive with Linux on it. Not sure if they're still around, but Clonezilla was a special build just for cloning drive.
 

Goi

Diamond Member
Oct 10, 1999
6,766
7
91
Full disk cloning isn't specific to Linux. There's a variety of Windows based utilities as well as hardware devices that will do it. If you're really set on using Linux, make a bootable USB drive with Linux on it. Not sure if they're still around, but Clonezilla was a special build just for cloning drive.
Are there free tools on Windows that are as easy as using dd to do a byte for byte clone (without booting up to a disk/etc)?
 

XavierMace

Diamond Member
Apr 20, 2013
4,307
450
126
Last I checked Macrium Free will. I'm pretty sure there's others, but there's generally pretty small number of scenarios where you need a sector level clone so I can't say I've looked.
 

Goi

Diamond Member
Oct 10, 1999
6,766
7
91
Thanks. I ended up using HDD Raw Copy Tool. It's much faster than dd from a guest Linux VM.