Skip to content

Instantly share code, notes, and snippets.

@erm3nda
Last active June 14, 2019 23:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erm3nda/2b2f43d03e4c458ac2ab5b54a604cc39 to your computer and use it in GitHub Desktop.
Save erm3nda/2b2f43d03e4c458ac2ab5b54a604cc39 to your computer and use it in GitHub Desktop.
VirtualBox create vmdk disk from physical drive

For Windows

VBoxManage internalcommands createrawvmdk -filename "C:\Users<user_name>\VirtualBox VMs<VM_folder_name><file_name>.vmdk" -rawdisk \.\PhysicalDrive0

For Linux

VBoxManage internalcommands createrawvmdk -filename "</path/to/file>.vmdk" -rawdisk /dev/sda

To access other partitions, just append -partitions 1,2 to the command

Known issues:

  • VERR_ACCESS_DENIED
    • Esto sucede porque el acceso raw a discos requiere permiso de administrador
  • VERR_SHARED_VIOLATION
    • Esto sucede en Windows, porque el dispositivo está "online" en el sistema y no puede darse acceso raw hasta que no esté desconectado. Con discos externos basta con desconectarlos una vez y conectarlos en caliente. Con discos internos necesitamos marcarlo offline con diskpart:
      • select disk 1
      • attributes disk clear readonly
      • offline disk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment