[SOLVED] LVM Disc not recognized after migrating to new sys

This forum is dedicated to advanced help and support :

Ask here your questions about advanced usage of Mageia. For example you may post here all your questions about network and automated installs, complex server configurations, kernel tuning, creating your own Mageia mirrors, and all tasks likely to be touchy even for skilled users.

[SOLVED] LVM Disc not recognized after migrating to new sys

Postby Marv » Dec 28th, '15, 05:57

Hi everyone,

I apologize for my first post here being a plea for help, but I'm pretty desperate.

I originally had a home server/media center originally running Mandriva 2010. I had a 160 gb boot drive with the OS and two LVMs for data. One VG was used to keep a full backup of the other one. The first VG consisted of two 1TB drives and the second was a single 2TB drive. Before I upgraded, I added another VG comprised of a single 3TB drive. I then rsync'd all data across all 3 VGs.

After the rebuild of the system, I planned to use the 3TB VG as is, and add 1TB to the 2TB VG. Being the dolt that I am, I somehow assumed that I could unplug the drives from the old system and the plug them back into the new one. I installed Mageia 2015 onto a fresh disc and got everything running. I first tried plugging in the 2TB drive and opening up disk manager in the control center. It recognized the LVM partition type, and I added it to a new VG and set a mount point for it. It then wanted to format the new VG, and of course I didn't let it do that, at which point it said it couldn't write the necessary entry to fstab.

At this point I'm kind of stuck. I have two discs, each with about 1.9 TB of data, that each originally belonged to separate VGs comprised of a single drive, and am not sure how to get them mounted again. After not having success with the 2TB, I haven't plugged in the 3TB at all for fear of corrupting it.

Any thoughts?

Many thanks!
Last edited by Marv on Dec 29th, '15, 01:22, edited 1 time in total.
Marv
 
Posts: 3
Joined: Dec 28th, '15, 05:25

Re: LVM Disc not recognized after migrating to new system

Postby doktor5000 » Dec 28th, '15, 14:52

On the new system, you want to import the old VG, and not add it to a new VG, as that would mess up the LVM headers IIUC.
See http://www.tldp.org/HOWTO/LVM-HOWTO/rec ... ewsys.html - exporting the VG on the old system shouldn't be necessary, but the rest is.

It would be helpful if you can attach the output of the following commands as root with the 2TB disk attached:
Code: Select all
fdisk -l
lsblk -fl
pvs
lvs
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18255
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: LVM Disc not recognized after migrating to new system

Postby Marv » Dec 28th, '15, 17:02

Thanks for the reply!

I think you nailed it with the LVM headers being messed up on the 2TB drive. And, I'm sure it's my fault because the lvmtools were not installed in Mageia to begin with. I have a feeling it may have just detected the LVM on bootup after I plugged it in if they had been installed.

I replaced the old Mandriva 2010 boot drive temporarily and started the machine with that. It wouldn't pick up that 2TB either. It would, however, detect the 3TB LVM. Since I had access to my data again, I decided to not risk it and copy it while I had the chance. At the moment, I am copying data from the 3TB LVM to another system. So, in a few hours, I will try to access the 3TB from the new Mageia install. I didn't even want to plug the 3TB in until I figured out what went wrong with the 2TB, and end up risking the data.

I'll let you know in a few hours.

Thanks again!
Marv
 
Posts: 3
Joined: Dec 28th, '15, 05:25

Re: LVM Disc not recognized after migrating to new system

Postby doktor5000 » Dec 28th, '15, 19:56

Marv wrote:I think you nailed it with the LVM headers being messed up on the 2TB drive.

Well, if you would have had formatted the new VG it would have messed them up. I'm not really sure it wrote anything, from your description:
Marv wrote:It recognized the LVM partition type, and I added it to a new VG and set a mount point for it. It then wanted to format the new VG, and of course I didn't let it do that, at which point it said it couldn't write the necessary entry to fstab.

So the 2TB drive may still be OK. But if it was already added to a new VG and if the LVM structures were written to disk, you may need to recover at least the old metadata.

It should still be present in the old system as /etc/lvm/backup. See e.g.
http://blog.adamsbros.org/2009/05/30/re ... t-backups/
http://unix.stackexchange.com/questions ... m-metadata
https://www.centos.org/docs/5/html/Clus ... cover.html
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18255
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: LVM Disc not recognized after migrating to new system

Postby Marv » Dec 29th, '15, 01:19

I'm pleased to report I have everything back to normal with no data loss.

I made a copy of all the files that were on the 3TB drive while it was running from the old Mandriva system. Once I was satisfied that they were safe, I shut everything down, and plugged in the boot drive with the fresh Mageia install. Plugged in the 3TB disc and started the system. I went into disc management in mcc and the existing VG contained on the 3TB was waiting for me to assign a mount point. Done! Had the lvmtools been installed before I plugged in the 2TB disc, I'm sure it would have appeared the same way.

So the 2TB drive may still be OK. But if it was already added to a new VG and if the LVM structures were written to disk, you may need to recover at least the old metadata.


I think this is what happened here-- due to not having lvmtools installed at first, it allowed me to do something stupid and add the disk to a new volume group and it likely did change the metadata. I'm not going to try to recover the 2TB at this point; I'll just build a new volume group with it and start over.

I guess the lesson that I learned here is to make sure lvmtools are installed on a new system before one starts plugging LVMs back in...

Many thanks to doktor5000 for all your help! I really appreciate it!
Marv
 
Posts: 3
Joined: Dec 28th, '15, 05:25


Return to Advanced support

Who is online

Users browsing this forum: No registered users and 1 guest