Obtain partition table for my MBR
Obtain partition table for my MBR
As far as I understand, the MBR holds the partition table for the disk. But suppose I want to write my own MBR to start other operating systems. Can I obtain the partition table in some way (is it stored somewhere else on the hard drive or something).
Re: Obtain partition table for my MBR
So I have to use the current MBR to obtain a table and then put that partition table in my own MBR?
- xenos
- Member
- Posts: 1121
- Joined: Thu Aug 11, 2005 11:00 pm
- Libera.chat IRC: xenos1984
- Location: Tartu, Estonia
- Contact:
Re: Obtain partition table for my MBR
When you write a new MBR to your hard disk, you have to restore the original partition table, otherwise you will lose the information about partitioning. To write an own MBR, you have to read the old MBR, put your new code section together with the old partition table and write both to disk.
Re: Obtain partition table for my MBR
Okey, thanks! So this is something I do when I actually "build" the MBR? In reality, exactly when do I "copy" the old partition table?
Just a quick thought..what if I have a hard drive which is not bootable? Right now I have two hard drives, and only one of them contains operating systems..or they still need a MBR?
Just a quick thought..what if I have a hard drive which is not bootable? Right now I have two hard drives, and only one of them contains operating systems..or they still need a MBR?
Re: Obtain partition table for my MBR
- Read old MBR;
- Extract partition table from old MBR;
- Write partition table into your new MBR;
- Write new MBR to disk.
Yes, non-bootable disks also have an MBR, as they also have to have a partition table. The MBR could be empty except for the partition table, though.
Every good solution is obvious once you've found it.
Re: Obtain partition table for my MBR
Thanks for all the replies!
What I really want to do right now (for fun), is to be able to boot my operating systems (win/linux) from a USB stick. So I want to put a MBR / simple "kernel" on an USB stick. Then I want to read the MBR from my hard drive, extract the partition table, and then be able to start from the different partitions.
What I really want to do right now (for fun), is to be able to boot my operating systems (win/linux) from a USB stick. So I want to put a MBR / simple "kernel" on an USB stick. Then I want to read the MBR from my hard drive, extract the partition table, and then be able to start from the different partitions.