HomeAbout MeProjectsContactMeow

dd is my fdisk

01 Dec 2025

I just did a fresh Linux install on a spare computer. After rebooting, I found that it would hang with a blinking cursor before entering GRUB. I've seen this before - in a multidisk setup, often it's caused by a disk that's marked as bootable that doesn't actually have a valid bootloader. Seeing as this machine has 2 disks, it seemed like a good thing to check. I boot up a live USB and get to work.

First, let's check if the secondary disk is bootable. We could probably do this through fdisk but I don't care. Let's just check it manually:

  $ sudo head -c 512 /dev/sdb | xxd
  00000000: 0000 0000 0000 0000 0000 0000 0000 0000  ................
  00000010: 0000 0000 0000 0000 0000 0000 0000 0000  ................
  00000020: 0000 0000 0000 0000 0000 0000 0000 0000  ................
  00000030: 0000 0000 0000 0000 0000 0000 0000 0000  ................
  00000040: 0000 0000 0000 0000 0000 0000 0000 0000  ................
  00000050: 0000 0000 0000 0000 0000 0000 0000 0000  ................
  00000060: 0000 0000 0000 0000 0000 0000 0000 0000  ................
  00000070: 0000 0000 0000 0000 0000 0000 0000 0000  ................
  00000080: 0000 0000 0000 0000 0000 0000 0000 0000  ................
  00000090: 0000 0000 0000 0000 0000 0000 0000 0000  ................
  000000a0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
  000000b0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
  000000c0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
  000000d0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
  000000e0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
  000000f0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
  00000100: 0000 0000 0000 0000 0000 0000 0000 0000  ................
  00000110: 0000 0000 0000 0000 0000 0000 0000 0000  ................
  00000120: 0000 0000 0000 0000 0000 0000 0000 0000  ................
  00000130: 0000 0000 0000 0000 0000 0000 0000 0000  ................
  00000140: 0000 0000 0000 0000 0000 0000 0000 0000  ................
  00000150: 0000 0000 0000 0000 0000 0000 0000 0000  ................
  00000160: 0000 0000 0000 0000 0000 0000 0000 0000  ................
  00000170: 0000 0000 0000 0000 0000 0000 0000 0000  ................
  00000180: 0000 0000 0000 0000 0000 0000 0000 0000  ................
  00000190: 0000 0000 0000 0000 0000 0000 0000 0000  ................
  000001a0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
  000001b0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
  000001c0: 0200 eeff ffff 0100 0000 afd2 3b77 0000  ............;w..
  000001d0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
  000001e0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
  000001f0: 0000 0000 0000 0000 0000 0000 0000 55aa  ..............U.

In BIOS systems, the disk is marked as bootable by the last two bytes of the first sector (512 bytes long) being set to 0x55AA. This is a magic number that IBM decided on. The above command prints out a hex dump of the first sector, and we can confirm that, due to the 0x55AA at the end, the disk is indeed marked bootable. Oh no! Luckily it's easy enough to fix:

$ sudo dd if=/dev/zero of=/dev/sdb bs=1 count=2 seek=510 % todo confirm
2+0 records in
2+0 records out
2 bytes copied, 0.000281409 s, 7.1 kB/s

We use dd to copy zeroes from /dev/zero to our disk. We set our block size to 1 with bs=1 so that our blocks are 1 byte long. We only want to copy 2 blocks - that's count=2 - and we want to skip over the first 510 bytes with seek=510.

And now let's confirm:

$ sudo head -c 512 /dev/sdb | xxd
00000000: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000010: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000020: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000030: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000040: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000050: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000060: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000070: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000080: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000090: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000000a0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000000b0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000000c0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000000d0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000000e0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000000f0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000100: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000110: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000120: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000130: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000140: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000150: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000160: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000170: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000180: 0000 0000 0000 0000 0000 0000 0000 0000  ................
00000190: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000001a0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000001b0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000001c0: 0200 eeff ffff 0100 0000 afd2 3b77 0000  ............;w..
000001d0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000001e0: 0000 0000 0000 0000 0000 0000 0000 0000  ................
000001f0: 0000 0000 0000 0000 0000 0000 0000 0000  ................

We can see now that the boot flag has been cleared. After a reboot I can confirm my computer is now booting properly - yay!

fdisk? f your disk :3