众所周知bootloader位于磁盘前446字节,属于stage1.0阶段
磁盘512字节后有一段空间是stage1.5阶段,用于找到启动的img和vmlinuz
众所周知,stage1.0-stage2.0都可以用grub2-install(CentOS6是grub-install)
参考:https://s4.51cto.com/wyfs02/M02/87/20/wKiom1fVBELjXsvaAAUkuL83t2Q304.jpg
[root@localhost ~]# dd if=/dev/zero of=/dev/sda bs=1 count=446
446+0 records in
446+0 records out
446 bytes (446 B) copied, 0.000932527 s, 478 kB/s
[root@localhost ~]# hexdump -C -n 512 /dev/sda
00000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
000001b0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 20 |............... |
000001c0 21 00 83 aa 28 82 00 08 00 00 00 00 20 00 00 aa |!...(....... ...|
000001d0 29 82 8e fe ff ff 00 08 20 00 00 f8 df 18 00 00 |)....... .......|
000001e0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
000001f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa |..............U.|
00000200
参考:https://blog.51cto.com/14012942/2434054
众所周知。stage1.0-stage2.0都用万能的grub2-install(CentOS6的grub太久,只能grub-install)
stage2.0就是内核镜像,initramfs,删这两个就用万能的重新安装内核即可,参考(没事别乱删):
CentOS7删除/boot/initramfsxxx.img并尝试光盘救援模式修复
CentOS7删vmlinuz玩
CentOS7删boot目录玩
现在破坏磁盘512字节后的内容:
[root@localhost ~]# dd if=/dev/zero of=/dev/sda bs=1 count=10240 seek=512 #seek,oflag,跳过目标文件512字节再开始
10240+0 records in
10240+0 records out
10240 bytes (10 kB) copied, 0.0173931 s, 589 kB/s
启动后连grub界面都看不到
使用stage阶段修复的万能法宝:grub2-install
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。