Koozali.org: home of the SME Server

Why I hate LVM; mounting a foreign drive.

Offline FreakWent

  • ****
  • 89
  • +0/-0
Why I hate LVM; mounting a foreign drive.
« on: November 03, 2007, 08:10:20 AM »
Hi.

Every single time I upgrade my server's hardware, the single old LVM drive causes me trouble.

Here I am, with the drive connected to a different system with LVM support:

fdisk:

   Device Boot      Start         End      Blocks   Id  System
/dev/hdd1   *           1          13      104391   fd  Linux raid autodetect
/dev/hdd2              14        9729    78043770   fd  Linux raid autodetect

/proc/mdstat:
Personalities :
md0 : inactive hdd2[0]
      78043648 blocks
       
unused devices: <none>


dmesg:
md: considering hdd2 ...
md:  adding hdd2 ...
md: hdd1 has different UUID to hdd2
md: created md2
md: bind<hdd2>
md: running: <hdd2>
md: md2: raid array is not clean -- starting background reconstruction
md: personality for level 1 is not loaded!
md: do_md_run() returned -22
md: md2 stopped.
md: unbind<hdd2>
md: export_rdev(hdd2)
md: considering hdd1 ...
md:  adding hdd1 ...
md: created md1
md: bind<hdd1>
md: running: <hdd1>
md: md1: raid array is not clean -- starting background reconstruction
md: personality for level 1 is not loaded!
md: do_md_run() returned -22
md: md1 stopped.
md: unbind<hdd1>
md: export_rdev(hdd1)


Elsewhere it was suggested that I re-created the PV, using the uid found in /etc/lvm/*/main

pvcreate -u 6oVVgd-WIVK-qB0y-PXk2-Acu5-ZxcI-gMj5JD /dev/hdd2
Software RAID md superblock detected on /dev/hdd2. Wipe it? [y/n] n
Physical volume β€œ/dev/hdd2″ successfully created

pvdisplay
β€” NEW Physical volume β€”
PV Name /dev/hdd2
VG Name
PV Size 74.43 GB
Allocatable NO
PE Size (KByte) 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID 6oVVgd-WIVK-qB0y-PXk2-Acu5-ZxcI-gMj5JD

Then pvdisplay again; no output, no pv found. Weird eh? You can pvcreate then pvdisplay once, then it’s gone!  Only the first pvdisplay works.

So where to from here? I feel from the mdstat that there is hope, but no....

mount /dev/md0 /wow
mount: /dev/md0: can't read superblock

cat /dev/md0 produces no output.

Can anyone please tell me, if not the fix(es) for my situation, the correct procedure to mount a single LVM drive from an SME 7 server in a seperate machine?

Thanks for _any_ help, I've had enough wasted weekends on stuff that should be easy:

Plug hard disk in
Turn on PC
Mount
Copy
End.





Offline Gaston94

  • *****
  • 184
  • +0/-0
Re: Why I hate LVM; mounting a foreign drive.
« Reply #1 on: November 05, 2007, 11:40:45 PM »
Hi,
I am sorry if I am rude, but I will not go in trying to understand or fix what has been done : moreore less, I would consider that running the pvcreate command was not the correct one : PE size is zero furthermore PE size is zero and you have zero PE available :(  and the pvcreate should it has to be run , should not have been run on the disk partition but on the raid device instead. I am sorry for your datas
 
Should you be lucky, the raid stucture and the real correct structure are still there, give a chance to the below method, no one knows ....

The thing with SME + RAID + LVM is that to access data on a such system you have to :
 - restart somehow the raid subsystem
 - activate the LVM mechanism
 - mount the LVM structure (lvol) on a mount point

the methodology has been discussed here in ldkeen reply Re: mount parameters for old server-disk   in something I consider to be as a nice way.
If you cannot start a system on the SME install CD with the old disk inside, you can have a look at the "complex" methodogy I described in this reply 

It's not the same way to address the problem but the goal is identical (and both are working).

Care understanding what has been written and what for it has been written.

G.

Offline byte

  • *
  • 2,183
  • +2/-0
Re: Why I hate LVM; mounting a foreign drive.
« Reply #2 on: November 06, 2007, 12:03:01 AM »
If you can wait there will be a NEW wiki page in the next day or so to show you how you can do this quite simply.
--[byte]--

Have you filled in a Bug Report over @ http://bugs.contribs.org ? Please don't wait to be told this way you help us to help you/others - Thanks!

Offline byte

  • *
  • 2,183
  • +2/-0
--[byte]--

Have you filled in a Bug Report over @ http://bugs.contribs.org ? Please don't wait to be told this way you help us to help you/others - Thanks!

Offline FreakWent

  • ****
  • 89
  • +0/-0
Re: Why I hate LVM; mounting a foreign drive.
« Reply #4 on: November 07, 2007, 07:59:30 AM »
Thanks heaps! a very useful page; butI am concerned that something bigger is wrong:

localhost ~ # mdadm -AR /dev/md8 /dev/sda2
mdadm: failed to RUN_ARRAY /dev/md8: Invalid argument
localhost ~ # cat /proc/mdstat
Personalities :
md8 : inactive sda2[0]
      78043648 blocks
       
unused devices: <none>
localhost ~ # pvs
localhost ~ #

see the problem here? The array never starts, and also pvscan always fails.

Offline FreakWent

  • ****
  • 89
  • +0/-0
Re: Why I hate LVM; mounting a foreign drive.
« Reply #5 on: November 07, 2007, 09:03:29 AM »
Great thanks to all who helped with various replies.  I knew that something was wrong and that this "unable to RUN_ARRAY" wasn't supposed to be there.

So, the lesson learned is this:

If you get "unable to RUN_ARRAY, invalid argument" and your device are always inactive, then _stop_ using your sleek hacked gentoo kernel and use a proper CD with proper raid support in the first place.  Of course, this should go without saying, but it seemed so much easier to work in my comfy existing environment.

Learning can be a very humbling experience.  I did try the SME rescue mode, some comments in other forum posts said to boot from the CD, press F5 and type 'sme rescue'.  This just booted the install mode so I didn't bother.

sysresccd gave lots of errors on /dev/nbd? devices when running pvscan, which scared me off.  I eventually tried again, and voila! The raid arrays start the way they should.

Thanks again all; chalk this up as a win for "back to basics" troubleshooting.