Here’s a tip for preparing a machine for re-imaging…

Whenever you are going to re-image a Linux machine (for instance, if you were going to use AutoYast or something to automatically rebuild the machine), it’s a good idea to wipe out the Master Boot Record first. This is to allow the new system to be built in properly, and avoid any problems with LILO or GRUB. You can do this either with a running Linux machine, or boot to a “live” cd/dvd (like Knoppix or what-have-you).

Simply enter the following at the prompt, as root:

dd if=/dev/zero of=/dev/hda bs=512 count=1

What the command does, is to copy null (zero) for one count of a block 512 bytes large, starting at the first possible byte of the disk known as hda (note that in this example case, the hard disk is an IDE drive, therefore is denoted as “hda“. Yours may be different. Use “df -h” or “mount” to find out).

The first 512 bytes contains your Master Boot Record and some other goodies, like your partition table. You can make the “bs” (block size) or count as big as you want (to overwrite as much of the hard drive as you wish), but keeping it at what I specified above will allow your running machine to *stay* running until you want to take it down gracefully…. but I’m not sure you’d care about taking it down gracefully at that point anyway…. 😉

Remember kiddies, this is a powerful command. Don’t use it on a machine unless you are absolutely certain you never want it to boot normally again!


Leave a Comment

Your email address will not be published.