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). _______________________________________________ bug-parted mailing list bug-parted@gnu.org http://lists.gnu.org/mailman/listinfo/bug-parted