This HOWTO addresses only the "lost partition table" problem. This can be when:
you have no more access to your computer, with the "no operating system" message;
you have installed a new system (i.e., MS Windows) and you see no more Linux, and MS Windows takes up all the capacity of the disk;
you have just partitioned the wrong drive with fdisk (for example, in the process of changing your hard drive).
Here, you will learn that, if you know the right thing and do it, Linux comes usually safe from such things. MS Windows can, but it's luckier.
We will first see what you can do before the problem to ease future recovery, and what you must do after to recover. There is little to do to prevent from erasing a disk; usually this is done by automatic MS Windows or Linux-install ill-behaved programs or users' mistakes - nothing can be done to prevent this, except care, but you are already careful, aren't you?
It can also be done by the use of MS-DOS/Windows fdisk. Avoid it as most as you can, but you probably can't.
I have done this many times, on my computer and on other guys' computers, and restored Linux most of the time and MS Windows sometimes. I wish you luck!
If you don't have any problem yet, if you read this by curiosity or are just seeking information, and you are on a running Linux system, do immediately the following :
open a root terminal or xterm;
key in /sbin/fdisk -l (that last character being l for Lima). Then do fdisk -u -l;
You will be gratified to see a list of all current partitions, on all disks present on your computer. The second one gives the listing in units of sectors, in place of cylinders, and this is sometimes necessary.
Write this back on paper (or do "/sbin/fdisk -l | lpr" and "/sbin/fdisk -u -l | lpr" to print it) and save it in a safe place for future use. If you are not the system administrator, you should not be concerned by the problem, and can stop reading this.
This HOWTO is Copyright (c) 2000-2008 by Jean-Daniel Dodin. As of November 2003, the licence is LGPL.
I am not responsible of any damage on any computer as a result of anyone reading this HOWTO. If you do any damage, it is YOUR fault, NOT MINE! Be careful when partitioning disks, and don't make any mistakes, because it can be fatal! Backup all your important data and check that everything you do is correct! What is described here worked on my computer, but it may or may not work on your computer. Although it should work for everyone, I can't guarantee anything. This is the last warning you get: BACKUP IMPORTANT DATA! Or, to put it concisely: Use at your own risk!
You need to know that, in case of any major problem with your hard disk, you need to stop using it in write mode, at least until the time for you to understand what's happening. Information there is very volatile...
If ever, one morning, awaking, your computer says "can't load, no system installed", you must not begin reinstalling all the stuff.
If you have MS Windows installed, I can't promise you can recover your data, but it's likely you will recover all your Linux stuff, provided it's not located too low (near the beginning of the disk) in the disk structure. This is because some MS Windows viruses erase the very first disk cylinder, whatever is on. However I didn't ever experiment with such viruses, and can't say for sure. Try recovering, anyway.
You must also know that I give you all this information only for this - information purposes. Neither I nor any other people but you can be held responsible for any problem your data can have using this info. There are too many different systems on the world for anybody being able to promise anything. I can only wish you luck and hope that you, like me, will be happy recovering data.