Last active
December 21, 2015 03:38
-
-
Save bldewolf/6243393 to your computer and use it in GitHub Desktop.
Messing around with MBRs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Messing around with MBRs is fun. For example, you can make overlapping | |
partitions. Well, not with fdisk, of course. You need to make the volume to | |
clone first, then shuffle it around with dd like so: | |
dd if=/dev/sda bs=1 skip=446 seek=462 of=/dev/sda count=16 | |
dd if=/dev/sda bs=1 skip=446 seek=478 of=/dev/sda count=16 | |
dd if=/dev/sda bs=1 skip=446 seek=494 of=/dev/sda count=16 | |
Once this is done, kick the kernel to reread the MBR (I usually do this with | |
fdisk because it amuses me that it will read and save this wacky partition | |
table but won't let you create it) and away we go! | |
root@archiso ~ # fdisk -l /dev/sda | |
Disk /dev/sda: 8589 MB, 8589934592 bytes, 16777216 sectors | |
Units = sectors of 1 * 512 = 512 bytes | |
Sector size (logical/physical): 512 bytes / 512 bytes | |
I/O size (minimum/optimal): 512 bytes / 512 bytes | |
Disk label type: dos | |
Disk identifier: 0xb25baaf1 | |
Device Boot Start End Blocks Id System | |
/dev/sda1 2048 16777215 8387584 83 Linux | |
/dev/sda2 2048 16777215 8387584 83 Linux | |
/dev/sda3 2048 16777215 8387584 83 Linux | |
/dev/sda4 2048 16777215 8387584 83 Linux | |
root@archiso ~ # od -x /dev/sda1 | |
0000000 0000 0000 0000 0000 0000 0000 0000 0000 | |
* | |
130 root@archiso ~ # od -x /dev/sda2 | |
0000000 0000 0000 0000 0000 0000 0000 0000 0000 | |
* | |
130 root@archiso ~ # od -x /dev/sda3 | |
0000000 0000 0000 0000 0000 0000 0000 0000 0000 | |
* | |
130 root@archiso ~ # od -x /dev/sda4 | |
0000000 0000 0000 0000 0000 0000 0000 0000 0000 | |
* | |
130 root@archiso ~ # yes lolo >/dev/sda1 | |
130 root@archiso ~ # head /dev/sda2 | |
lolo | |
lolo | |
lolo | |
lolo | |
lolo | |
lolo | |
lolo | |
lolo | |
lolo | |
lolo | |
root@archiso ~ # head /dev/sda3 | |
lolo | |
lolo | |
lolo | |
lolo | |
lolo | |
lolo | |
lolo | |
lolo | |
lolo | |
lolo | |
root@archiso ~ # head /dev/sda4 | |
lolo | |
lolo | |
lolo | |
lolo | |
lolo | |
lolo | |
lolo | |
lolo | |
lolo | |
lolo | |
More bad ideas to come. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment