createrawvmdk does not work

Discussions related to using VirtualBox on Linux hosts.

createrawvmdk does not work

Postby d3bug » 1. Jun 2008, 05:47

VirtualBox 1.5.6 on mint Linux 5 (Ubuntu/debian based)


The format listed in the manual is:

VBoxManage internalcommands createrawvmdk -filename /path/to/file.vmdk -rawdisk /dev/sda -partitions 1,5

however, issuing that command with a proper path/filename and partition information causes the following error:

Syntax error: Invalid command 'createrawvmdk'

further, it indicates the only valid "internalcommands" are:

loadsyms, unloadsyms, and setvdiuuid

so how do you REALLY do it (create a VMDK for raw partition access)?
d3bug
 
Posts: 1
Joined: 1. Jun 2008, 05:41

Postby thomaslundgaard » 2. Jun 2008, 00:35

Hi!

I had the same problem on debian/lenny.
After searching the net, I found that the problem is, that the createrawvmdk command is not avaliable in the open source edition.

If you download the closed-source edition (still free for personal use), you will be able to create the image.
Link to download:
https://cds.sun.com/is-bin/INTERSHOP.en ... DS-CDS_SMI

Good luck :)
thomaslundgaard
 
Posts: 1
Joined: 2. Jun 2008, 00:29

Postby joebpimentel » 4. Jun 2008, 21:54

Cannot create vmdk file when using the -partitions option:

Code: Select all   Expand viewCollapse view
bash$ VBoxManage internalcommands createrawvmdk -filename /home/user/.VirtualBox/WinXP.vmdk  -rawdisk /dev/sda -partitions 1 -mbr /home/user/.VirtualBox/fakeMBR.mbr  -relative
VirtualBox Command Line Management Interface Version 1.6.0
(C) 2005-2008 Sun Microsystems, Inc.
All rights reserved.

ERROR: VMDK: cannot go backwards for partition data in '/home/user/.VirtualBox/WinXP.vmdk'
Error code VERR_INVALID_PARAMETER at /home/vbox/vbox-1.6.0/src/VBox/Devices/Storage/VmdkHDDCore.cpp(2527) in function int vmdkCreateRawImage(VMDKIMAGE*, VBOXHDDRAW*, uint64_t)
Error while creating the raw disk VMDK: VERR_INVALID_PARAMETER

bash$ VBoxManage internalcommands listpartitions  -rawdisk /dev/sda
VirtualBox Command Line Management Interface Version 1.6.0
(C) 2005-2008 Sun Microsystems, Inc.
All rights reserved.

Number  Type   StartCHS       EndCHS      Size (MiB)  Start (Sect)
1       0x07  0   /1  /1   1023/254/63         23846           63
2       0x83  1023/0  /1   1023/254/63         14307     48837600
3       0xbf  1023/0  /1   1023/254/63         15366     78140160
6       0x83  1023/254/63  1023/254/63         18708    109611621
5       0x82  1023/254/63  1023/254/63          4094    147926520

bash$ fdisk -l /dev/sda

Disco /dev/sda: 80.0 GB, 80032038912 bytes
255 heads, 63 sectors/track, 9730 cylinders
Units = cilindros of 16065 * 512 = 8225280 bytes
Disk identifier: 0xcccdcccd

Dispositivo Boot Início Fim Blocos Id Sistema
/dev/sda1               1        3040    24418768+   7  HPFS ou NTFS
/dev/sda2            3041        4864    14651280   83  Linux
/dev/sda3   *        4865        6823    15735667+  bf  Solaris
/dev/sda4            6824        9730    23350477+   5  Estendida
/dev/sda5            9209        9730     4192965   82  Linux swap / Solaris
/dev/sda6            6824        9208    19157449+  83  Linux




Any clues on this error (VMDK: cannot go backwards for partition data in '/home/user/.VirtualBox/WinXP.vmdk')?
joebpimentel
 
Posts: 5
Joined: 4. Jun 2008, 21:42

Postby postfix » 5. Jun 2008, 01:34

there is something worng with the partition order. it must be reorded, and a few other problems (caused by sideeffects) must be repaird too.

just read about doing this in the discussion at http://forums.virtualbox.org/viewtopic.php?t=4501&highlight=ubuntu@ubuntu
postfix
 
Posts: 41
Joined: 14. Jan 2008, 13:05

Think had done everything right ...

Postby joebpimentel » 5. Jun 2008, 22:26

Now the partition order seems to be ok, tks to postfix... :)

Code: Select all   Expand viewCollapse view
$ sudo fdisk -l
Disk /dev/sda: 80.0 GB, 80032038912 bytes
255 heads, 63 sectors/track, 9730 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0xcccdcccd

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1        3040    24418768+   7  HPFS/NTFS
/dev/sda2            3041        4864    14651280   83  Linux
/dev/sda3   *        4865        6823    15735667+  bf  Solaris
/dev/sda4            6824        9730    23350477+   5  Extended
/dev/sda5            6824        9208    19157449+  83  Linux
/dev/sda6            9209        9730     4192965   82  Linux swap / Solaris

$ VBoxManage internalcommands listpartitions -rawdisk /dev/sda
VirtualBox Command Line Management Interface Version 1.6.0
(C) 2005-2008 Sun Microsystems, Inc.
All rights reserved.

Number  Type   StartCHS       EndCHS      Size (MiB)  Start (Sect)
1       0x07  0   /1  /1   1023/254/63         23846           63
2       0x83  1023/0  /1   1023/254/63         14307     48837600
3       0xbf  1023/0  /1   1023/254/63         15366     78140160
5       0x83  1023/254/63  1023/254/63         18708    109611621
6       0x82  1023/254/63  1023/254/63          4094    147926520


But still ...

Code: Select all   Expand viewCollapse view
$ VBoxManage internalcommands createrawvmdk -filename /home/user/.VirtualBox/WinXP.vmdk  -rawdisk /dev/sda -partitions 1 -mbr /home/user/.VirtualBox/fakeMBR.mbr
VirtualBox Command Line Management Interface Version 1.6.0
(C) 2005-2008 Sun Microsystems, Inc.
All rights reserved.

ERROR: VMDK: cannot go backwards for partitioning information in '/home/user/.VirtualBox/WinXP.vmdk'
Error code VERR_INVALID_PARAMETER at /home/vbox/vbox-1.6.0/src/VBox/Devices/Storage/VmdkHDDCore.cpp(2518) in function int vmdkCreateRawImage(VMDKIMAGE*, VBOXHDDRAW*, uint64_t)
Error while creating the raw disk VMDK: VERR_INVALID_PARAMETER


Stucked here! ... :(
joebpimentel
 
Posts: 5
Joined: 4. Jun 2008, 21:42

Postby postfix » 6. Jun 2008, 16:51

The shown partiton structure seemd to be ok. I thing you checkt it using fdisk. Does it happend again if your are using new VBox 1.6.2?

If it should happen again, then bug-testing inside the source code will be necessary. Make a bug ticket, please.
postfix
 
Posts: 41
Joined: 14. Jan 2008, 13:05

Postby joebpimentel » 8. Jul 2008, 22:42

joebpimentel
 
Posts: 5
Joined: 4. Jun 2008, 21:42

Postby Sasquatch » 8. Jul 2008, 22:58

Have you tried to put the -mbr parameter before the -partition option? It might be that that is it's problem. It's possible that the command starts reading at a certain sector and is not able to go back to the beginning when creating a raw VMDK file for the mbr. Usually, the MBR is created first too.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
Sasquatch
Volunteer
 
Posts: 17800
Joined: 17. Mar 2008, 13:41
Location: /dev/random
Primary OS: Debian other
VBox Version: PUEL
Guest OSses: Windows XP, Windows 7, Linux

Postby TerryE » 9. Jul 2008, 00:25

No, I've looked that the code. I've just had a dialogue with Klaus on a related ticket (#688). The F/E routine VBoxManageInternal.cpp CmdCreateRawVMDK at line 951 calls a function partRead (lines 484-648) to build and to validate the partition list that is used later to create the VBOXHDDRAW structure. At line 1093 it then calls VDCreateBase to create the VMDK passing the VBOXHDDRAWstructure (overloaded as a char *pszComment, yukkk!). This routine in VBox-HDDnew.cpp is basically just a wrapper call the pfnCreate method in VmdkHDDCore.cpp at line 3570. This then calls vmdkCreateImage which in the case of a RAW disk then calls vmdkCreateRawImage (Lines 2456-2689) to do the work.

This contains extra sequencing logic to check partitions again. You actually barf at an ascending sequence check at line 2517. By my reading this should be redundant as it is largely the same as the partRead validation. Clearly it can't be as this one fails. You really need the debugger to work this one out.

One check you could to eliminate one factor is to try a
Code: Select all   Expand viewCollapse view
VBoxManage internalcommands createrawvmdk -filename ~/.VirtualBox/WinXP.vmdk  -rawdisk /dev/sda -partitions 1
(that is without the MBR) just to see if this fails and also a
Code: Select all   Expand viewCollapse view
VBoxManage internalcommands createrawvmdk -filename ~/.VirtualBox/WinXP.vmdk  -rawdisk /dev/sda
then we know that the error is purely sequencing the MBR and EBRs.

I really don't know why VBox overlays this disk management function into the whole F/E to B/E architecture. It would just be a lot simpler to create some simple cut-down standalone utilities to manage the image files. This is just simple file manipulation. Heck, you could do this job in a few hundred lines of perl/python, or a 1,000 lines of C++. Why bother to complicate things?

Who wants "production" code that is called by "internalcommands" with all sorts of health warnings anyway!
TerryE
Site Moderator
 
Posts: 3572
Joined: 28. May 2008, 08:40
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: Ubuntu 10.04 & 11.10, both Svr&Wstn, Debian, CentOS

Postby joebpimentel » 18. Jul 2008, 19:03

Sorry, I was in a hurry with job subjects and only today I can try the commands:

First try (without the MBR) fails the same way ...

Second try (without -partitions) worked but I believe it is useless, it is not?

(Thanks for the follow-up)
joebpimentel
 
Posts: 5
Joined: 4. Jun 2008, 21:42

Postby TerryE » 19. Jul 2008, 00:55

What this tells us is that (1) the MBR flag has nothing to be with the error and (2) the error path is excited by processing a partition list but not a whole disk. Can I suggest that you feed this data into the ticket.
Read the Forum Posting Guide
Google your Q site:VirtualBox.org or search for the answer before posting.
TerryE
Site Moderator
 
Posts: 3572
Joined: 28. May 2008, 08:40
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: Ubuntu 10.04 & 11.10, both Svr&Wstn, Debian, CentOS

Postby joebpimentel » 21. Jul 2008, 11:48

Conclusions added to the bug ticket http://www.virtualbox.org/ticket/1777.
joebpimentel
 
Posts: 5
Joined: 4. Jun 2008, 21:42

Re: createrawvmdk does not work

Postby fisasi » 10. May 2010, 18:01

Hello:
I have a different problem:
VBoxManage internalcommands createrawvmdk -filename ~/.VirtualBox/WinXP.vmdk -rawdisk /dev/sda1
WARNING: The vboxdrv kernel module is not loaded. Either there is no module
available for the current kernel (2.6.31.12-0.2-desktop) or it failed to
load. Please recompile the kernel module and install it by

sudo /etc/init.d/vboxdrv setup

You will not be able to start VMs until this problem is fixed.
WARNING: The compilation of the vboxdrv.ko kernel module failed during the
installation for some reason. Starting a VM will not be possible.
Please consult the User Manual for build instructions.
Sun VirtualBox Command Line Management Interface Version 3.1.6
(C) 2005-2010 Sun Microsystems, Inc.
All rights reserved.

Error while creating the raw disk VMDK: VERR_ALREADY_EXISTS
The raw disk vmdk file was not created

Obviously, executing sudo /etc/init.d/vboxdrv setup I can't do anything
Which could be my error (I am new in Suse)
Thanks
fisasi
 
Posts: 1
Joined: 10. May 2010, 17:49
Primary OS: openSUSE
VBox Version: PUEL
Guest OSses: WindowsXP


Return to VirtualBox on Linux Hosts

Who is online

Users browsing this forum: Google [Bot] and 10 guests