Hard Drives and MBR

Hello everyone. I have a question which I may know the answer to, I'm just looking for a confirmation. When it comes to the MBR of a hard drive, i've read in multiple sources that it's always located in the first sector of the hard drive. Is the MBR there from the factory? When I buy a new blank drive from a store, will it have that first sector reserved and MBR in place?

When I use a program like fdisk in linux, it doesn't allow to modify or write to the first 63 sectors. Is this because of the MBR? Do I have that right, or is the MBR applied when you install a bootable partition?

Any insight in this would be helpful. Thanks!

I'll explain this first: A hard drive doesn't know or care what its contents are. If it gives you sector 123523 when you ask for 123523, it has fulfilled its responsibility.

You don't "install" an MBR, it's just there, in sector zero, because that's where your computer expects it to be by tradition. If sector zero doesn't have valid contents, your computer just won't boot from it. More modern things like GPT -- which can have partitions much larger than a basic DOS-style MBR would support -- have extra data elsewhere as well, at the end of the disk I believe...

You don't get to put partitions in the first 63 sectors just because that's how DOS-style partition tables work, they can't represent numbers any lower than that.

Some disks will come formatted with a sensible MBR. Some just fill it with zeroes. It doesn't matter much, since there's no barrier to doing what you please with it.

The only thing actually stopping you from writing over the MBR is the operating system. When you partition a device in Linux, it breaks it out into separate pretend-devices like /dev/sda1, /dev/sda2, and so forth. Theyr'e safely compartmentalized, they won't let you write beyond their bounds, but it's the OS doing that for your convenience, not the disk itself. You can use /dev/sda itself if you want to talk to the raw device, but almost nothing except a partition editor would need to do so.

It's important to note that the MBR occupies the first sector --not 63-- of a disk (usually 512 bytes).

The first 63 sectors of any disk are commonly known as track0 and may contain a MBR, vendor information or just zeroes.

The concept is often mistaken with the partition table which happens to take 64 bytes of the MBR in most systems.

The MBR (Master Boot Record) resides on the first sector of the disk and is where control is passed to by the machine BIOS.

The MBR will be different from operating system to operating system, and each operating system will have a way of writing its own MBR.

For example, in Windows

 
fdisk /mbr

(google that for syntax) will write an MBR and on Solaris the

 
installboot

command will write an MBR.

If an MBR exists at all when the disk comes from the factory, that will just be from the manufacturing test process and probably won't be what you need for your O/S. When the O/S install routine runs it will install its MBR.