[CentOS] Analyzing the MBR

Thu Jun 5 20:31:27 UTC 2014
John R Pierce <pierce at hogranch.com>

On 6/5/2014 12:07 PM, Timothy Murphy wrote:
>> >A) the boot code, which is read and executed by the BIOS at boot time,
>> >only on the boot drive
>> >and
>> >B) the master partition table, which is read on any drive when its
>> >inserted
> That doesn't really answer my question;
> I know (roughly) what the MBR, ie the first 512 bytes, contains.
> But I notice that my laptop, for example, leaves 64 sectors
> for something at the start of the disk;
> and when I get the first 2048 bytes with
>    sudo dd if=/dev/sda of=sda.mbr bs=2048 count=1
> I see that there is plenty on the disk after the first 512 bytes.
> (Admittedly Windows might have written that, as I have a Windows partition.)
> But does Linux ever write anything in bytest 513-1024, for example?

traditional PC partitioning tools, dating back to MSDOS, put partitions 
on 'cylinder' boundaries.   this is a bad idea on modern disks, whether 
they be SSD's that often have 128K physical write blocks, or newer HD's 
with 4096 byte physical sectors, or raids where there's several of the 
above striped together.

the rest of the space between the sector 0 MBR and the first primary 
partition is completely empty, nothing puts anything there.

I always start my first partition at a round number SECTOR, like 128s 
(which is 64k bytes assuming 512B sectors) so everything is aligned on a 
power-of-two boundary....   I use parted, rather than fdisk, to do 
this.   something like...

parted -a min /dev/sdb
mklabel gpt
mkpart pri 128s -1s
quit
mkfs.xfs -L datavol1 /dev/sdb1
echo "LABEL=datavol1   /data   xfs   defaults   1 2" >> /etc/fstab
mount /data

(actually, I probably would have made this an LVM VG but I left that 
part out)

-- 
john r pierce                                      37N 122W
somewhere on the middle of the left coast