bug-parted
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to know the present partition system when the partition table is


From: Jim Meyering
Subject: Re: how to know the present partition system when the partition table is overwritten?
Date: Sun, 02 May 2010 19:19:34 +0200

jdd wrote:
> I know this is not the true object of this mailing list, But you are
> probably very good on the subject and I don't know where to ask :-(
>
> I'm the "Partition HOWTO" author. One of my readers says that:
>
> * he have overwritten the partition table on a bad way
> * but the computer is still on (no reboot)
>
> How can I know what are the partition limits (sectors) to rebuild the
> good table? The kernel knows, of course, but what command can I use to
> read this from meory, the disk file being lost?

If he is using a GPT (aka GUID) partition table, it should be easy to
restore from the backup/secondary GPT header, which is at the end of the disk.
I think parted can do this for you, but I haven't tried it recently.

Unfortunately, it seems most people are stuck in the dark ages,
thinking that they can use GPT only with some special BIOS.
Not true.  GPT works everywhere, except on some unusual, broken BIOSes.

If he was using an MSDOS partition table, he'll have to go a different
route:

On most modern linux-based kernels, you can use /sys to determine
the layout of existing, known-to-kernel partitions.

For just the first partition of /dev/sda, do this:

    $ head /sys/class/block/sda1/{start,size}
    ==> /sys/class/block/sda1/start <==
    64

    ==> /sys/class/block/sda1/size <==
    1048576

Friendly advice: use GPT.
And no matter what partition table format you use,
backup/version-control a copy of your configuration (the first 16KiB).




reply via email to

[Prev in Thread] Current Thread [Next in Thread]