Opened 14 years ago
Last modified 14 years ago
#7896 new defect
VB creates wrong .vmdk on Mac OSX
Reported by: | Alexey Kuznetsov | Owned by: | |
---|---|---|---|
Component: | other | Version: | VirtualBox 4.0.0 |
Keywords: | Cc: | ||
Guest type: | other | Host type: | other |
Description
Here on mac we all have one restrictions: you can't access /dev/disk0 even from root account. And when you need to access local hard drive under from VB you need to take a dance with scripts.
I'll be short.
vmdk file created with following command are look like this:
# VBoxManage internalcommands createrawvmdk -filename ~/Library/VirtualBox/HardDisks/localhost-fedora.vmdk -rawdisk /dev/disk0 -partitions 0,1,3,4
# Disk DescriptorFile version=1 CID=08ee3126 parentCID=ffffffff createType="partitionedDevice" # Extent description RW 1 FLAT "localhost-fedora-pt.vmdk" 0 RW 409639 FLAT "/dev/disk0s1" 0 RW 105505120 ZERO RW 262144 ZERO RW 616930936 FLAT "/dev/disk0s3" 0 RW 155900928 ZERO RW 97502216 FLAT "/dev/disk0s4" 0 RW 262184 ZERO # The disk Data Base #DDB ddb.virtualHWVersion = "4" ddb.adapterType="ide" ddb.geometry.cylinders="16383" ddb.geometry.heads="16" ddb.geometry.sectors="63" ddb.uuid.image="a6aeccaa-3aef-4beb-87b5-8b589dccc940" ddb.uuid.parent="00000000-0000-0000-0000-000000000000" ddb.uuid.modification="00000000-0000-0000-0000-000000000000" ddb.uuid.parentmodification="00000000-0000-0000-0000-000000000000"
but to works correctly it should be this:
# Disk DescriptorFile version=1 CID=08ee3126 parentCID=ffffffff createType="partitionedDevice" # Extent description RW 40 FLAT "localhost-fedora-pt.vmdk" 0 RW 409600 FLAT "/dev/disk0s1" 0 RW 105505120 ZERO RW 262144 ZERO RW 616930936 FLAT "/dev/disk0s3" 0 RW 155900928 ZERO RW 97502216 FLAT "/dev/disk0s4" 0 RW 262151 ZERO RW 33 "localhost-fedora-bt.vmdk" 0 # The disk Data Base #DDB ddb.virtualHWVersion = "4" ddb.adapterType="ide" ddb.geometry.cylinders="16383" ddb.geometry.heads="16" ddb.geometry.sectors="63" ddb.uuid.image="a6aeccaa-3aef-4beb-87b5-8b589dccc940" ddb.uuid.parent="00000000-0000-0000-0000-000000000000" ddb.uuid.modification="00000000-0000-0000-0000-000000000000" ddb.uuid.parentmodification="00000000-0000-0000-0000-000000000000"
just to mention, wrong lines are (ala diff):
[...] RW 40 FLAT "localhost-fedora-pt.vmdk" 0 RW 409600 FLAT "/dev/disk0s1" 0 [...] RW 262151 ZERO RW 33 "localhost-fedora-bt.vmdk" 0 [...]
some additional info:
sh-3.2# VBoxManage internalcommands listpartitions -rawdisk /dev/disk0 Number Type StartCHS EndCHS Size (MiB) Start (Sect) 1 0xee 1023/254/63 1023/254/63 200 1 2 0xaf 1023/254/63 1023/254/63 51516 409640 3 0x83 1023/254/63 1023/254/63 301235 106176904 4 0x07 1023/254/63 1023/254/63 47608 879008768
sh-3.2# gpt -r show /dev/disk0 gpt show: /dev/disk0: Suspicious MBR at sector 0 start size index contents 0 1 MBR 1 1 Pri GPT header 2 32 Pri GPT table 34 6 40 409600 1 GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B 409640 105505120 2 GPT part - 48465300-0000-11AA-AA11-00306543ECAC 105914760 262144 106176904 616930936 3 GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B 723107840 155899904 5 GPT part - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 879007744 1024 879008768 97502216 4 GPT part - EBD0A0A2-B9E5-4433-87C0-68B6B72699C7 976510984 262151 976773135 32 Sec GPT table 976773167 1 Sec GPT header sh-3.2#
and finely, how to create the right -pt, and -bt files:
dd if=/dev/disk0 of=localhost-fedora-pt.vmdk count=40 bs=512 dd if=/dev/disk0 of=localhost-fedora-bt.vmdk skip=976773135 count=33 bs=512
Note:
See TracTickets
for help on using tickets.
miss type, the line:
should look like: