1 Master Boot Record, Booting from USB etc.(8)
2 ============================================
6 mbr - Master Boot Record, Booting from USB etc.
14 This document is work in progress.
17 We are using /dev/sdz as the typical device name. Adjust it to whatever
18 your device corresponds to of course, it's just to prevent any data loss due to
24 The Master Boot Record (MBR) is the first data block with 512 bytes on the x86
25 architecture providing a partition table and a bootloader. In the first 446
26 bytes is the bootcode, providing the bootloader (400 bytes), a disk signature (4
27 bytes) and NULL (2 bytes). The following 64 bytes are the partition table,
28 followed by 2 bytes which are the MBR signature.
33 The bootcode consists of bootloader and disk signature:
38 Windows: ntldr with boot.ini (Windows NT/XP) or bootmgr with \Boot\BCD (Windows Vista)
43 Operating systems like Windows identify the disk using the disk signature.
44 Running 'fixmbr' doesn't touch the disk signature but just the bootloader.
45 Running 'fdisk /mbr' touches the bootloader *and* the disk signature (it writes
46 a standard MBR, it won't touch the partition table though).
47 TODO: what about fixboot?
52 Harddisk addressable: 8GB (Cylinder Head Sector, CHS), 2TB (Logical Block
53 Addressing with 32bit, LBA) or >2TB (GUID Partition Table, GPT)
58 The 2 bytes 55 and AA (both hex), known as the Magic Number. This signature
59 tells the system that there should exist a valid MBR - otherwise you'll get
60 something like "No operating system" or "Non-Bootable Disk".
67 # dd if=/dev/sdz of=mbr_backup.dd bs=512 count=1
69 Restore the MBR again:
71 # dd if=mbr_backup.dd of=/dev/sdz bs=512 count=1
73 Clone MBR *without* partition table:
75 # dd if=/dev/sdz of=mbr_bootcode.dd bs=446 count=1
77 Restore MBR *without* partition table again:
79 # dd if=mbr_bootcode.dd of=/dev/sdz bs=446 count=1
81 Backup partition layout:
83 # sfdisk -d /dev/sdz > backup.sfdisk
85 Restore partition layout again:
87 # sfdisk /dev/sdz < backup.sfdisk
91 lilo -M /dev/sdz -s /dev/null
96 * USB-HDD: usually the default and prefered booting mode.
97 * USB-ZIP: ??? - can be set up via:
99 # mkdiskimage -4 /dev/sdz 1 64 32 # device = 1GB
100 # mkdiskimage -4 /dev/sdz 0 128 32 # device >1GB and <=2GB
101 # mkdiskimage -F -4 /dev/sdz 0 255 63 # device >2GB and <=8GB
103 For devices above 8GB (taken from
104 http://www.knoppix.net/wiki/Bootable_USB_Key):
106 # mkdiskimage -F -4 /dev/sdz 1 255 63
107 # dd if=/dev/zero of=/dev/sdz bs=1 seek=446 count=64
108 # echo -e ',0\n,0\n,0\n,,C,*' | sfdisk /dev/sdz
110 USB-ZIP requires to have 64 heads and 32 sectors and less than 1024
118 Check out the *real* difference between:
120 # mbr-install /dev/ice
121 # lilo -S /dev/null -M /dev/ice ext && lilo -S /dev/null -A /dev/ice 1
122 # cat /usr/lib/syslinux/mbr.bin > /dev/ice
124 # syslinux -sf /dev/iceX
125 # mkdiskimage ... (USB-ZIP?)
130 * How does a correct partition look like?
131 * The partition should start behind MBR at 1st cylinder and 63rd sector?
132 * fdisk -l -u /dev/sdz vs. fdisk -l /dev/sdz
137 * http://de.wikipedia.org/wiki/Master_Boot_Record
138 * http://en.wikipedia.org/wiki/Master_boot_record
139 * http://michael-prokop.at/blog/2007/04/22/booting-from-usb-pen-troubleshooting-and-pitfalls/
140 * http://www.ata-atapi.com/hiwmbr.html
141 * http://thestarman.pcministry.com/asm/mbr/index.html