Operating System - HP-UX
1752278 Members
5021 Online
108786 Solutions
New Discussion юеВ

Getting data off old disk (no longer part of VG?)

 
SOLVED
Go to solution
Vetto
New Member

Getting data off old disk (no longer part of VG?)

OK...I have been supporting an old HP 10 system for a few years, but have never gotten into lvm stuff (it always just worked.) I am studying, but need a boost right now:

I have a single disk (/dev/dsk/c0t1d0) that is assigned to /dev/vg03. The VG contains no other physical volumes. The box's boot disk failed and the user ignited the box and ran a mod tape that recreated all the system software architecture (including recreating the VG's).

Knowing that he had no backups of the database on this box, he removed and replaced the c0t1d0 disk prior to rebuilding the box.

Now the box is working, the databases are there but empty, and all the VGs are mounting properly.

PROBLEM: the database backups are on the "old" c0t1d0 drive that WAS part of VG03. I replaced the "new" disk with the "old" disk to see if I could cp the files off it...but I cannot mount it, I get the "vgchange: Warning: Couldn't attach to the volume group physical volume "/dev/dsk/c0t1d0" " error.

I assume (not knowing yet how PV assignment works) that the system is trying to assign the PV to the VG but it knows that this is not the same physical disk that the VG is supposed to have...

How can I reassign VG03 to this existing disk vice the "new" disk and then cp off the data?

***given enough time, I would never ask this basic admin question...I would study and figure it out on my own but I am in a time crunch.
7 REPLIES 7
James R. Ferguson
Acclaimed Contributor

Re: Getting data off old disk (no longer part of VG?)

Hi:

# mkdir /dev/vg03
# mknod /dev/vg03/group c 64 0x030000
# vgimport -v /dev/vg03 /dev/dsk/c0t1d0
# vgchange -a y /dev/vg03

Now mount whatever directories you want on whatever logical volumes are available. Since we didn't define a mapfile, the logical volume names will be the default nomenclature ('lvol1', 'lvol2', etc).

Regards!

...JRF...
Vetto
New Member

Re: Getting data off old disk (no longer part of VG?)

OK, but there is already a VG03 created and it has a pv assigned to it (the new disk that replaced the one I need to get stuff off of).
Vetto
New Member

Re: Getting data off old disk (no longer part of VG?)

Let me see if I understand what you are trying to get me to do ( I generally dont arbitrarily run commands from the internets on a system without understanding what I am doing :) )

# mkdir /dev/vg03
this already exists, can I skip this?

# mknod /dev/vg03/group c 64 0x030000
Since vg03 is already in use with the "new" disk, I assume that this special file already exists also. right?

# vgimport -v /dev/vg03 /dev/dsk/c0t1d0
So, turn off the machine, replace the "new" c0t1d0 that is working within vg03 with the old one with the data I need. Boot into single user mode. Run this commned to "remap" the old now-installed c0t1d0 drive back to the existing vg03

# vgchange -a y /dev/vg03
Do I have to do this? the vg is already active...or do I have to "reactivate" it because I changed to disk?

What is telling the system that the old disk that I pulled out is not the real disk that vg03 needs? It WAS the vg03 disk prior to rebuilding the box and configuring LVM exactly as before.
James R. Ferguson
Acclaimed Contributor
Solution

Re: Getting data off old disk (no longer part of VG?)

Hi (again) Vetto:

> I generally don't arbitrarily run commands from the internets on a system without understanding what I am doing

That's always wise. However, if you look at the rankings here, you'll see that for whatever its worth, I've been around a while and have contributed quite a bit :-)) Take the advice and read the manpages. After all, it was you who said, "...given enough time, I would never ask this basic admin question...I would study and figure it out on my own but I am in a time crunch."

If you already have a 'vg03' I'd make a different volume group. It doesn't matter what the physical volume was once assigned to in its former life. Use any unused minor number. Do an 'ls -l /dev/vg??/group' to see what's already taken and pick an open number that is less than your 'maxvgs' [default is 10 decimal counting from zero].

Assuming that minor number four (4) is available:

# mkdir /dev/vg04
# mknod /dev/vg04/group c 64 0x040000
# vgimport -v /dev/vg04 /dev/dsk/c0t1d0
# vgchange -a y /dev/vg04

Now, mount what you need to recover and when done, you can eliminate the volume group just created with:

# vgchange -a n /dev/vg04
# vgexport /dev/vg04

Keep the physical disk or reuse it by doing a 'pvcreate' on it.

Regards!

...JRF...
Ganesan R
Honored Contributor

Re: Getting data off old disk (no longer part of VG?)

Hi Vetto,

I would go with James suggestion if I am in your situation.

Import the "old disk with data" into new volume group and mount the logical volumes and copy the data to wherever you need.

I have a another thought if you still specically needs to import the "old disk with data" to VG03.

1. Just export the vg VG03 which has "new disk without any data". I am assuming that there is no data on new disk. If you have data just backed up before export it.
#vgexport /dev/vg03

2.Now VG03 is not there and system doesn't know anything about VG03. Create a directory for VG03 and group file for it. Use the appropriate minor numer (0x030000)

# mkdir /dev/vg03
# mknod /dev/vg03/group c 64 0x030000

3. Now import the "old disk with data" to the newly created vg03. It is not necessary that the "old disk with data" should have same device file.

#vgimport -v /dev/vg03 /dev/dsk/c0t1d0

4.Activate the VG

# vgchange -a y /dev/vg03

Now you are back to state before you rebuild the server. Mount the logical volumes and access the data. Only thing is that now the lv names will be standard like lvol1, lvol2..
Best wishes,

Ganesh.
Vetto
New Member

Re: Getting data off old disk (no longer part of VG?)

James, thanks. That worked perfectly. Created new VG05, imported the old disk into the VG, activated the VG, mounted the lvol, copied off that data, deactivated vg, and removed the VG05.

I have a much better understanding of LVM now, thanks to your example and the MAN pages.
Vetto
New Member

Re: Getting data off old disk (no longer part of VG?)

Used JRF's solution above.