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.

0

1 Answer 1

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
3
  • It works so perfectly! I just can't believe Oracle did not document this.
    – Shayan
    Nov 1, 2019 at 18:57
  • \\.\PHYSICALDRIVE4 Also works.
    – Shayan
    Nov 1, 2019 at 20:25
  • 1
    Thanks Shayan. My original post did not include codeblocks, so I had to use escape-sequences (double backslash) to get single backslashes to print. A forum mod came along and edited the post to include codeblocks and highlights on some keywords, which really is helpful and makes it more readable overall, but it looks like they left the escape-sequences just in those leading spots, which then printed literally in full in a codeblock. I'm new - hopefully I'll remember to use those dandy formatting tricks in the future :-P
    – user116960
    Nov 7, 2019 at 5:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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