Page 1 of 1

Custom MBR

Posted: 24. Feb 2011, 20:54
by guilty
Hi,

I would like to change MBR of a virtual OS in VirtualBox. The problem is that I can't really find exactly what I need. What I do find is how to change MBR while running OS from physical disk, and i need to change it for OS in virtual disk. Am I missing something here?

I'm using Ubuntu 10.10, VirtualBox v4.0.4.

Thanks in advance.

-- Paul

Re: Custom MBR

Posted: 25. Feb 2011, 13:27
by mpack
Whatever method you find for changing an MBR will, if it works, work in any similar PC whether it be physical or virtual - so just boot up the guest PC and do it.

I'm curious though: why would you want to change the MBR?

Re: Custom MBR

Posted: 26. Feb 2011, 23:12
by guilty
I don't remember the command exactly, but according to it's manual, the '-mbr' switch can be used only when physical partition parameter's are present.

We're writing a basic OS as an assignment in my university, so we need a custom MBR :)

Re: Custom MBR

Posted: 27. Feb 2011, 13:09
by mpack
Well, any tool which can write to sector 0 of a drive can change an MBR. You would need to know your way around a short x86 assembly language program, and also understand the partition map structure. The consequences of messing up on a live disk is likely to be a disk that won't boot and/or the loss of all data on the drive. It goes without saying that you need to be an expert and a programmer to do any of this, and as such a programmer should have no difficulty finding out how to write to the MBR of a VDI file using a host app (which would certainly simplify some access problems).

Re: Custom MBR

Posted: 28. Feb 2011, 12:48
by guilty
I am fully aware of the consequences, that's why I am trying to use VirtualBox. I also do have knowledge of assembly, c and basic concepts of OS that I might need in this project.

What I do not have, however, is knowledge of this particular software, called VirtualBox. This is why I came to it's official forums, to thread "Using VirtualBox". IMO, this thread's purpose is talk about "Using VirtualBox", but that might be a crazy idea, I'm no pro on threads. So, I'm asking once again, and please don't respond if it is just to imply (or say directly) that I should use google. If you would tell that to everyone, who enters any forum, not just this one, all of the forums would be dead. Hell, face to face communication would be dead, because everyone could use google instead.

Back to topic: I have 512 MB virtual disk drive. How would I tell VirtualBox to use a custom MBR?

--Paul

Re: Custom MBR

Posted: 28. Feb 2011, 13:26
by mpack
So, you need information about the virtual disk formats which VirtualBox supports.

VDI is VirtualBox's native virtual hdd format, you can find introductory information on that in the FAQ section of the "Howtos and Tutorials" forum on this site (TerryE's "All About VDIs" tutorial). Other than that the information must be gained by downloading and studying the VirtualBox source code (OSE). The latter step is such an obvious one that I wondered why a programmer would not have done so already, which is why I asked.