Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
If you haven't rebooted, your last-known partition info is in /proc/partitions. Just save that pseudo-file (it's actually memory) to a flashdrive or print it so you have some idea of your partition setup if you reboot and find your partition tables really gone.
Your partition table is part of your MBR (Master Boot Record) which in turn is part of "Track 0" (the first track on your harddrive). The MBR is the first sector (512 bytes) or track zero (which is 63 sectors -> 63x512 bytes).
So, to copy your MBR (which includes the partition table), do this:
dd bs=512 if=/dev/sda of=/tmp/first_disk_mbr.bin
You will have to adjust the above example where I used /dev/sda so that it points the disk you want to look at. DO NOT CONFUSE "if" (Input File) and "of" (Output File) otherwise you will lay waste to you MBR!!!
To copy all of Track 0, just modify the above command a little:
Before I said your partition table was only 16 bytes long. Wrong! I don't know where that stupid thought popped into my head. It's 64 bytes long. Each RECORD within the partition table is 16 bytes long, and there are four recods total. Sorry about my brain-fart there. Don't know what I was thinking.
Your 512 byte long MBR is broken up like this:
first 446 bytes: boot code
next 64 bytes: partition table
last 2 bytes: Should be set to something specific (I forgot what, but it's always the same). I *think* Windows and some other tools might look at these two bytes, but I don't think Linux does.
I forgot the structure of a single partition record within the partition table, but I'm sure a Google search would reveal lot's of help in that area. You should be able to use "dd" to dump your MBR to a file, then use "od" to examine the 64 bytes of that that make up the partition table. By the way, did I remember to say DO NOT CONFUSE "if" and "of" ???!!!
Distribution: debian on servers, ubuntu on desktops/laptops
Posts: 45
Original Poster
Rep:
The solution ended up being the following:
Took one of the members of the RAID1 array, attached to the new system with working LVM. pvscan and vgscan showed the LVM on the single disk, activated with "vgchange -a y", mounted the logical volumes and moved off the data (this is where I also learned that keeping VG names unique between systems is handy when trying to access LVM on a different system with existing LVM setup). Still unclear as to why LVM was mad on the old box.
This was the easiest solution because that machine was using RAID1 and so each disk in the array had a copy of all the data. I since had to help someone who was using Linux MD RAID5 (yuck!) and had a motherboard failure. The fix there was to grab the RAID info from /etc/mdadm/mdadm.conf (he had wisely previously emailed himself that config along with output of "cat /proc/mdstat" and "mdadm -D /dev/md1"). Boot that system to a live cd (sysresccd.org is a life saver), recreate the array using the array info and move off the data.
Bottom line is, Linux MD Raid and LVM are awesome tools. Go Open Source. Yay.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.