Advertisement
opexxx

Mounting a VirtualBox VDI disk on linux.txt

Aug 13th, 2013
276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.13 KB | None | 0 0
  1. Mounting a VirtualBox VDI disk on linux
  2.  
  3. I just had an “Unsupported version 13 of data unit 'pgm' (instance #1, pass 0xffffffff) (VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION).” error on a Windows VirtualBox machine where I had some important python scripts.
  4.  
  5. I couldn't boot the machine at all, so in order to recover those files I had to search on how to mount a VDI disk file and here is the how-to:
  6.  
  7. First of all you will need the qemu-nbd binary, so look up how is packaged in your distro, in my case (openSUSE 11.4) it is within virt-utils, in (openSUSE 12.2) it is within qemu-tools.
  8.  
  9. After you installed the package, execute these commands as root:
  10. Mounting
  11.  
  12. # Load the nbd kernel module
  13. modprobe nbd max_part=16
  14.  
  15. # Link a block device named /dev/nbd0 to the vdi file
  16. # Partitions will appear as /dev/nbd0p1 and so on
  17. qemu-nbd -c /dev/nbd0 <vdi-file>
  18.  
  19. # Mount the first partition within /mnt/tmp
  20. mount /dev/nbd0p1 /mnt/tmp
  21.  
  22. Now you can copy your files to the local filesystem
  23. Un-mounting
  24.  
  25. # Unmount the partition
  26. umount /mnt/tmp/
  27.  
  28. # Unlink the vdi file
  29. qemu-nbd -d /dev/nbd0
  30.  
  31. # Remove the kernel module
  32. rmmod nbd
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement