[lug] is there a way to get partition table on running system?

Aaron D. Johnson adj at fnord.greeley.co.us
Fri Nov 8 10:08:32 MST 2013


Bear Giles writes:
> Thanks.  Hopefully I was able to recreate the partition table
> correctly.  The #sectors looks right but I don't know if they've
> been offset.

As you've already discovered, /proc/partitions only lists your
partitions' sizes, not their starting offsets.  I don't find anything
useful in my kernel's printk output about partition sizes or offsets,
either.  (It might be nice to have for just this sort of situation.)

gpart is a tool to help with exactly this problem.
http://www.brzitwa.de/mb/gpart/

In future, you might consider running with GPT partitioned disks.
You'll get an extra copy of the partition table at the end of the disk
with that.  A weekly cron job sending the output from "fdisk -lu;
parted -l; mdadm --detail /dev/md*; lvdisplay -a -m" to a gmail
account (or similar) has proved useful in the past, too.

I hope your /boot recreation is going well.

- Aaron


More information about the LUG mailing list