On Tue, 2 Jun 2009, David Bolt wrote:-
It would also appear to work for pre-allocated Virtualbox disc images as
well, however you'd need to skip the first 33280 bytes. To do this,
you'd need to set a block size of 512 and use "skip=65" to skip over the
extra data.
Okay, that won't work for all drive sizes. The offset depends on the
size of the disc image, and 65 would only work for an 8GiB image. The
exact offset can be calculated by reading the 32bit (64bit?) value at
offset 0x158. The following simple program should suffice:
===== START =====
#include
#include
int
main(int argc,char **argv)
{
FILE *fd;
ulong offset;
uint bs;
if(!(fd=fopen(argv[1],"rb")))
exit(1);
if((fseek(fd,0x154L,SEEK_CUR)))
exit(1);
fread(&bs,sizeof(bs),1,fd);
fread(&offset,sizeof(offset),1,fd);
printf("Virtual drive MBR is located at offset %lu\n",offset);
printf("command required is:\ndd if=%s of=OUTFILE bs=%u skip=%lu\n",
argv[1],
bs,
(offset/bs));
fclose(fd);
exit(0);
}
===== END =====
Pass the name of the Virtualbox drive image and it'll tell you the
offset to the drives MBR and show you the dd command required to
extract/copy/whatever the drive image.
Regards,
David Bolt
--
Team Acorn: http://www.distributed.net/ OGR-NG @ ~100Mnodes RC5-72 @ ~1Mkeys/s
openSUSE 10.3 32b | openSUSE 11.0 32b | |
openSUSE 10.3 64b | openSUSE 11.0 64b | openSUSE 11.1 64b |
RISC OS 3.6 | RISC OS 3.11 | openSUSE 11.1 PPC | TOS 4.02
--
To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse+help@opensuse.org