In the last part of this series, you have learned how to recover from problems occurring in your Master Boot Record. It has showed you how to get it back once it has been removed. Here we continue with troubleshooting the partition table of the Master Boot Record. Without a partition table, you cannot access any of the information on your computer's hard drive, so if it gets lost, recovering it is critical.
In general, you can encounter two different kinds of problems in regard to partitions. You may have lost the complete partition table, or you may have a problem with the file system on a partition. Here, you'll learn how to recover the partition table. To do this, you need your rescue CD and to find the exact information about the beginning and end of the partitions on your server's hard disk. Once you've found that, use to recreate the partitions. The following procedure sho...
To continue reading for free, register below or login
To read more you must become a member of SearchEnterpriseLinux.com
');
// -->

ws how to do this.
1. Start your server from the rescue CD and make sure that you open a console where you have root permissions.
2. Type to scan your hard drive for all partitions. This may take between five seconds and an hour. Once finished, it will show you partition information:
Evaluate the information that gpart provides carefully, after all, gpart stands for guess partition. It guesses, nothing more, nothing less. On the example server I have swap in a logical parition /dev/sda5. As you can see, gpart found the swap partition with its correct size, beginning and end on disk, but couldn't find that it was a logical partition. Based on this information, you would try to recreate the swap partition on /dev/sda2. Your server would boot with that, but would give errors as well. But, that doesn't really matter because once booted you can check system files like /etc/fstab to find the partition your swap originally was, and repair the partitions.
3. Now that you have found the original partition boundaries, write them down and start fdisk using . This shows you a message about your disk's size, ignore that and type to start the interface to create a new partition. Next, type to create the first primary partition. It asks what partition number you want to assign, type .
4. Next comes the important part: you have to specify where the partition originally started and ended. To find this information, you need the C/H/S line in the gpart output for this partition. Consider the line below:
In this line, the first number between brackets indicates the original starting cylinder, which in this example is cylinder 0. The second series of numbers between brackets tells you where the partition originally ended, in this case that is on cylinder 992. There is one catch though: in fdisk the first cylinder is cylinder 1. That means that all other cylinders as displayed with gpart need to be incremented with 1. So, you have to create a partition now that starts at cylinder 1 and ends on cylinder 993. Repeat steps 3 and 4 to recreate your other partitions as well and then close fdisk using the command. Fdisk probably gives a message now that the new partition table can be used only after a reboot. The example below shows what has happened so far:
to get an overview of available partition types, and use to change the type of a partition. Don't forget to reboot after changing your partition table.
So now you have learned how to get back your partitions if they were lost. The next part in this series will teach you how to fix problems with LVM logical volumes.
ABOUT THE AUTHOR: Sander van Vugt is an author and independent technical trainer, specializing in Linux since 1994. Vugt is also a technical consultant for high-availability (HA) clustering and performance optimization, as well as an expert on SLED 10 administration.