3

I want to pipe my converted .vdi file into /dev/sda. My box.vdi is 2TB and my HDD is also 2TB, but the system I am doing the conversion from is only 128GB. All the resources (ref1 and ref2) I can find say I need to write it to an intermediate file and then dd that .img file into /dev/sda.

When I run: vboxmanage clonemedium box.vdi /dev/null --format=RAW; I get: VBoxManage: error: Cannot create destination file "/dev/null": VERR_ALREADY_EXISTS; Same with trying to write to /dev/sda.

This answer suggests I can use a pipe, but I get the error error: unknown option: - and that answer if from an old version of VirtualBox.

# vboxmanage clonemedium  box.vdi - --format=RAW | dd of=/dev/null

Oracle VM VirtualBox Command Line Management Interface Version 7.0.12 Copyright (C) 2005-2023 Oracle and/or its affiliates

VBoxManage: error: unknown option: -

Usage - Create a clone of a medium:

VBoxManage clonemedium <uuid | source-medium> <uuid | target-medium> [disk | dvd | floppy] [--existing] [--format= VDI | VMDK | VHD | RAW | other ] [--variant=Standard,Fixed,Split2G,Stream,ESX]

# vboxmanage clonemedium  box.vdi --format=RAW | dd of=/dev/null              
Oracle VM VirtualBox Command Line Management Interface Version 7.0.12
Copyright (C) 2005-2023 Oracle and/or its affiliates

VBoxManage: error: Mandatory output file parameter missing
Brandon
  • 269

1 Answers1

3

A good enough solution to this involves using vboxmanage internalcommands createrawvmdk --filename mapped_drive.vdi --rawdisk /dev/sdX to map a .vdi file to the physical drive. Then you can attach the mapped drive and the drive you want to clone on a new vm. Inside the vm both drives will appear and you can use dd if=/dev/sdb of=/dev/sdc or pv /dev/sdb --sync > /dev/sdc to copy the data from one to the other.

Brandon
  • 269