"raw partitions" usage in VirtualBox?

Discussions related to using VirtualBox on Solaris hosts.
Post Reply
pfuetz
Posts: 4
Joined: 19. Mar 2008, 15:39

"raw partitions" usage in VirtualBox?

Post by pfuetz »

Folks,

I do have a question, that I hope, you can help me with...

I do have an old PC, with THREE disks:

1. disk is totally given to Win95
2. disk is totally givene to "files"
3. disk is partitioned into three (four) partitions, hosting Win98,
SuSE 7.2, SuSE 7.2 swap, and Solaris 7.

I now did boot Solaris on that box, and made "dumps" of the partitions as
follows:

dd if=/dev/rdsk/c0t0d0p1 of=win95.raw bs=512
dd if=/dev/rdsk/c0t1d0p1 of=temp.raw bs=512
dd if=/dev/rdsk/c0t2d0p1 of=win98.raw bs=512
dd if=/dev/rdsk/c0t2d0p2 of=suse72.raw bs=512
dd if=/dev/rdsk/c0t2d0p4 of=solaris7.raw bs=512

Now, under OpenSolaris build 84, I try the following:

lofiadm -a /path/to/win95.raw /dev/lofi/1
VBoxManage internalcommands createrawvmdk -filename /path/to/win95.vmdk -rawdisk /dev/rlofi/1 -partitions 1

and do get:

# VBoxManage internalcommands createrawvmdk -filename /export/images/vbox_or_xvm/WIN95.vmdk -rawdisk /dev/rlofi/1 -partitions 1
VirtualBox Command Line Management Interface Version 1.5.51
(C) 2005-2008 innotek GmbH
All rights reserved.

Overlapping partitions. Aborting
Error reading the partition information from '/dev/rlofi/1'
#

Or:

# VBoxManage internalcommands createrawvmdk -filename /export/images/vbox_or_xvm/WIN95.vmdk -rawdisk /dev/rlofi/1
VirtualBox Command Line Management Interface Version 1.5.51
(C) 2005-2008 innotek GmbH
All rights reserved.

Error while creating the raw disk VMDK: VERR_INVALID_PARAMETER
#

So, I read the user-manual of the VirtualBox, and it seems, I really need the
whole disk images, and not only the images of the partitions. So, i guess, I
should have done:

dd if=/dev/rdsk/c0t0d0p0 of=disk0.raw bs=512
dd if=/dev/rdsk/c0t1d0p0 of=disk1.raw bs=512
dd if=/dev/rdsk/c0t2d0p0 of=disk2.raw bs=512

Right?

So, my questions are:

Is the the only way to "handle" raw disks?
Or is there a way to re-use the "dump" of a partition as an image for
VirtualBox?

BTW: I can do the following:

# mkdir /a
# mount -F pcfs -o ro /dev/lofi/1 /a
# ls /a
ADOBEPS Eigene Dateien My Music XWIN32
AUTOEXEC.BAT Exchange Neue Software.lnk antje
Anti-Vir.Dat GSview PSP default.set
BOOTLOG.PRV IO.SYS Programme emacs
BOOTLOG.TXT LEADVIEW QTAKE euracom
COMMAND.COM LILO.TGZ RECYCLED gs
CONFIG.SYS LOGO.SYS SCANDISK.LOG iomega
DBLSPACE.BIN MACARONI SCSI liprefs.js
DETLOG.OLD MPEG SUHDLOG.DAT psfonts
DETLOG.TXT MSDOS.--- SYSTEM.1ST sun
DINFO2 MSDOS.SYS WINDOWS
DRVSPACE.BIN MSOffice WINPLAY3
#

So, the file itself is a real dump of the FAT32 part of the disk!

Curious,
Matthias

P.S.: Some more infos:

fdisk c0t0d0p0:

Total disk size is 131 cylinders
Cylinder size is 16065 (512 byte) blocks

Cylinders
Partition Status Type Start End Length %
========= ====== ============ ===== === ====== ===
1 Active DOS-BIG 0 130 131 100




fdisk c0t1d0p0:

Total disk size is 131 cylinders
Cylinder size is 16065 (512 byte) blocks

Cylinders
Partition Status Type Start End Length %
========= ====== ============ ===== === ====== ===
1 DOS-BIG 0 130 131 100




fdisk c0t2d0p0:

Total disk size is 8188 cylinders
Cylinder size is 1090 (512 byte) blocks

Cylinders
Partition Status Type Start End Length %
========= ====== ============ ===== === ====== ===
1 DOS-BIG 0 2726 2727 33
2 Linux native 2726 5231 2506 31
3 Solaris 5232 5453 222 3
4 Active Solaris 5453 8179 2727 33

(Remark: The small "Solaris" partition is the Linux Swap partition!)
pfuetz
Posts: 4
Joined: 19. Mar 2008, 15:39

Post by pfuetz »

So, next problem.

Now I have done the following:

On the old PC under Solaris 7/x86 I did:

dd if=/dev/rdsk/c0t0d0p0 of=disk0.raw bs=512

Then I copied the file to my new laptop, running Nevada build 84 with
VirtualBox, and there on the new laptop I did:

lofiadm -a /export/images/vbox_or_xvm/disk0.raw /dev/lofi/1
cd /opt/VirtualBox/
VBoxManage internalcommands listpartitions -rawdisk /dev/rlofi/1

Output of that is:

VirtualBox Command Line Management Interface Version 1.5.51
(C) 2005-2008 innotek GmbH
All rights reserved.

Number Type StartCHS EndCHS Size (MiB) Start (Sect)
1 0x06 0 /1 /1 130 /254/63 1027 63

So, the diskimage is correct, and it contains a Window95 version!

(Here's the proof:

bash-3.2# mkdir /a
bash-3.2# mount -F pcfs /dev/lofi/1:c /a
bash-3.2# ls /a
ADOBEPS Eigene Dateien My Music XWIN32
AUTOEXEC.BAT Exchange Neue Software.lnk antje
Anti-Vir.Dat GSview PSP default.set
BOOTLOG.PRV IO.SYS Programme emacs
BOOTLOG.TXT LEADVIEW QTAKE euracom
COMMAND.COM LILO.TGZ RECYCLED gs
CONFIG.SYS LOGO.SYS SCANDISK.LOG iomega
DBLSPACE.BIN MACARONI SCSI liprefs.js
DETLOG.OLD MPEG SUHDLOG.DAT psfonts
DETLOG.TXT MSDOS.--- SYSTEM.1ST sun
DINFO2 MSDOS.SYS WINDOWS
DRVSPACE.BIN MSOffice WINPLAY3
bash-3.2# umount /a
bash-3.2# rmdir /a

)

Now, I want to add this to the list of images that VirtualBox can use:

According to the manual, I assume, that I should be able to do:

VBoxManage internalcommands createrawvmdk -filename /export/images/vbox_
or_xvm/disk0.vmdk -rawdisk /dev/rlofi/1

or (see above for the mountpoint for /a!)

VBoxManage internalcommands createrawvmdk -filename /export/images/vbox_
or_xvm/disk0.vmdk -rawdisk /dev/lofi/1

BUT (with both commands) the output is:

VirtualBox Command Line Management Interface Version 1.5.51
(C) 2005-2008 innotek GmbH
All rights reserved.

Error while creating the raw disk VMDK: VERR_INVALID_PARAMETER

So, what's wrong?

Here's the excerpt from the UserManual.pdf, Page 111/112:

To create an image that represents an entire physical hard disk (which
will not contain any actual data, as this will all be stored on the
physical disk), on a Linux host, use the command

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

This creates the image /path/to/file.vmdk (must be absolute), and all
data will be read and written from /dev/sda.

Very confused!

Any help highly appreciated!

Matthias
Post Reply