--1421910094-100496463-931797998=:26114
Content-Type: TEXT/PLAIN; charset=US-ASCII
Hi there.
>> I found block lengths etc of my partitions... I accidentally
>> blew away my partition table (fd0!=hda) and unfortunately I have
>> no way to do a backup and so have little. The system is still
>> up and running. Is there anyway I can recreate exactly the same
>> partition table?
> Yes.
>> I imagine all the information is in /proc, but I can't find it.
It's not all in /proc but almost all of it is there...
> cat /proc/partitions
> This gives the partition sizes. It may not be enough as you
> don't get the exact placement, but it worked for me when I did
> exactly the same thing. I used fdisk and recreated my
> partitions in order and with exactly the same sizes. Note that
> cfdisk will want to start the first partition on a cylinder
> bounddary, while fdisk can start on a track boundary. The
> latter was necessary in my case, as an NT partition started on
> the second track on the first cylinder.
> Before you reboot, make sure you have a linux boot floppy with
> fdisk on it. A debian install/rescue diskette is ok.
> You can then retry if your first attempt goes wrong.
> Helge Hafting
Can I offer the enclosed bash shell script, which uses the available
information to reconstruct the partition table ready for it to be
recreated using `fdisk -u` (ie, this provides sector numbers).
There are two cases where it will get the details wrong:
1. It assumes that the whole of the first track of cylinder 0
is unused, and reserved for the partition table. On some
systems, only the first sector thereof is unused.
2. It assumes that all allocated partitions are consecutively
allocated (ie, there are no gaps between them). This is not
always the case, but it is usually true.
In addition, this version fails to detect the boot partition. However,
if you use LILO to boot, that can be determined by reading the
relevant line in /etc/lilo.conf although if you use LOADLIN or some
other boot loader, I've no idea where one would look to discover that.
If it gets the details wrong in other cases, please let me know,
providing a copy of the output from `fdisk -l` together with the
output from this program...
Best wishes from Riley.
+----------------------------------------------------------------------+
| There is something frustrating about the quality and speed of Linux |
| development, ie., the quality is too high and the speed is too high, |
| in other words, I can implement this XXXX feature, but I bet someone |
| else has already done so and is just about to release their patch. |
+----------------------------------------------------------------------+
* ftp://ftp.MemAlpha.cx/pub/rhw/Linux
* http://www.MemAlpha.cx/kernel.versions.html
--1421910094-100496463-931797998=:26114
Content-Type: TEXT/PLAIN; charset=US-ASCII; name=repart
Content-Transfer-Encoding: BASE64
Content-ID: <Pine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PiYyDQoJICAgIGV4aXQgMQ0KCWZpDQog
ICAgZmkNCmRvbmUNCg==
--1421910094-100496463-931797998=:26114--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/