Removing the MBR/partition information

Note: By running any of the following commands you may cause your system to become un-bootable. Best make backups of the MBR prior to trying anything within. Use at your own discretion.

URLs:

Ben Okopnik wrote a good article on the linux gazette site called “Clearing out the Master Boot Record”. I was wanting to clear the MBR/partition information so that I could reboot the system and re-intstall using DHCP/TFTP/bootp etc… The BIOS is set to boot of USB-CDROM->HDD->Net/None. So, unless the system failed to boot/find the MBR I couldn’t rebuild. (The system was remote and only reachable via the installed TCP/IP settings and respective OS’s).

It turns out it’s fairly simple to delete the MBR from within Linux:

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

The above dd command deletes both the MBR and disk partition information on device hda. Ideal for what I wanted. You could of course backed up your MBR with:

dd if=/dev/hda of=mbr.bin bs=512 count=1

So, after rebooting the linux system it started building off the build server.

Windows was a little bit harder to find information about deleting the MBR. On the Linux Gazette article it said:

DOS-based solution

Boot with a DOS floppy that has “debug” on it; run “debug”. At the ‘-‘ prompt, “block-fill” a 512-byte chunk of memory with zeroes:

f 9000:0 200 0

Start assembly mode with the ‘a’ command, and enter the following code:

mov dx,9000
mov es,dx
xor bx,bx
mov cx,0001
mov dx,0080
mov ax,0301
int 13
int 20

Press <Enter> to exit assembly mode, take a deep breath – and press “g” to execute, then “q” to quit “debug”. Your HD is now in a virgin state, and ready for partitioning and installation.

Although I could type in all the commands I kept hitting an exception when I pressed “g” to execute. Windows would send a popup box saying something along the lines of “NTVDM encountered a hard error”. After rebooting the system came up so the above doesn’t work unless you boot up using a boot disk.

After a bit more searching I found TestDisk which is:

TestDisk is a powerful free data recovery software! It was primarily designed to help recover lost partitions and/or make non-booting disks bootable again when these symptoms are caused by faulty software, certain types of viruses or human error (such as accidentally deleting a Partition Table). Partition table recovery using TestDisk is really easy.

Using this software on Windows it allowed the deletion of the MBR/partition table by simply downloading, extracting and running one command.

Rebooting the system now allowed me to get on with re-installing the machine over the net.

Buggy Plesk 8.3 migration manager (migration tool)

As SwSoft, now known as Parallels, introduced an end of life policy for supporting old OSes I’ve had to migrate a number of Fedora Core machines to Ubuntu 6.06 LTS. The best way of doing this is via the migration manager from the new Plesk node. However, the migration manager will copy everything over, but, due to a bug in their code it doesn’t copy over auto_increment options in the databases. This obviously causes major issues with databases that use auto_increment that are migrated over.

The option about Mysql compatibility with the older versions was defined in Plesk Migration manager, the file is /opt/psa/PMM/agents/shared/Db/MysqlShellBackend.pm.
I have commented out the values:
root at hostname:~# cat /opt/psa/PMM/agents/shared/Db/MysqlShellBackend.pm | grep compatible
# $self->{not_compatible_mysql_323} = $params{not_compatible_mysql_323} if defined $params{not_compatible_mysql_323};
# $dumpoptions .= ” –compatible=mysql323 ” if !$self->{not_compatible_mysql_323} && $self->_mysql41OrNewer();

Comment out those two lines and Plesk database migrations should work alright.

NOTE: This should be fixed in newer Plesk 8.3 releases

a