Thursday, March 23, 2017

linux - How do I keep a drive from booting accidently that used to be a bootable drive?



I used to have a RAID 0 setup but I ditched it and restarted from scratch with a plain non raid single disk system. The second disk is just used for general storage.



Well today, I boot the machine and for whatever reason the BIOS booted from the secondary drive which still had the old RAID 0 boot record and OS and everything. Took me a few minutes to figure out what went wrong, I changed the boot order in my BIOS and my 'new' machine came back.



How do I blow away the bootability of the old secondary drive without destroying any of the partitions on it? The MBR has the partition table so I can't just blow it away, but I can't find any partition tool that will erase the MBR while keeping the partition table.




This is a ubuntu 10.10 setup.


Answer



The actual MBR boot loader is located on the first sector of the hard drive. This sector also contains the partition table for the drive, so care must be taken to remove the boot loader code without removing the partition table. The following command should do it:



dd if=/dev/null of= bs=446 count=1



Slightly more information is at this URL WARNING: Before making this modification, have good backups available.


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...