1

I know this command for VirtualBox for converting a physical hard disk (with Linux OS installed on it) to a virtual image from the Linux environment:

cat /dev/sda | VBoxManage convertfromraw stdin OutPutFile.vdi

But what is the equivalent of this in Windows 10 command prompt?

  • I also can't change /dev/sda to for example A:\ because the hard disk is a ext4 file system so it is not mounted and there's no drive letter assigned to it.

I need to know how to point to that disk, it can't be mounted but it's online as shown in Disk Management.

I have read the manual pages and I can't find my answer still:

https://www.virtualbox.org/manual/ch08.html

I think the equivalent of cat for Windows is type What is the Windows equivalent of the Unix command cat? but I'm not sure if it can be used here.

And if it can be used to stdout the hard disk then maybe I can use this How do I use a pipe to redirect the output of one command to the input of another? to save the stdout to file then send the file to VBoxManage. Or use pipe in Windows? Will it work the same as Linux?

Also this /dev/sda equivalent in Windows doesn't seem to help in my situation, because I get VERR_FILE_NOT_FOUND.

Shayan
  • 1,893

1 Answers1

2

You use Windows' Physical Device Access path notation:
\\.\PHYSICALDRIVE# where the # represents an index number.

Drives in Windows are 0-base indexed, but that doesn't mean PhysicalDrive0 is your Windows-resident or boot disk - it means it's the physical drive connected to the mainboard at the lowest possible IO port (they'll be numbered on the mobo, but not necessarily zero-base indexed). You can find the index-number you need by going into the Disk Management Snap-In (diskmgmt.msc) - it will show connected drives with some identifying details such as mounted filesystems/drive letters/partitions.

Make damn sure you target the correct HDD device if you're writing to it.

Windows XP SP2 and up requires that the disk be "unmounted" so you really, seriously can't do this on the Windows-resident HDD. Reads into certain sectors will fail just as hard as writes will anywhere at all.

VBoxManage convertfromraw \\.\PHYSICALDRIVE4 C:\SomeDirectory\MyVDI.vdi --format VDI