Operating System - HP-UX
1823065 Members
3050 Online
109645 Solutions
New Discussion юеВ

shortcut to copy layout of my VGs to another machine

 
SOLVED
Go to solution

shortcut to copy layout of my VGs to another machine

Hi,

I would like to copy layout of my VGs to another machine. I know this can be done manually. What I want to know is if there are shortcuts to it.

Many Thanks,

Charlie
10 REPLIES 10
KapilRaj
Honored Contributor

Re: shortcut to copy layout of my VGs to another machine

i think u can do it by copying

/dev/vg* # lvm device files
/etc/lvmconf # Not sure this is the path but similier


Kaps
Nothing is impossible
Michael Tully
Honored Contributor

Re: shortcut to copy layout of my VGs to another machine

I am not sure that will work, just copying the files.

You would really need to create the LVM again (mkdir /dev/vgXX and mknod) and then using vgimport mapfiles generated from other system.
Anyone for a Mutiny ?

Re: shortcut to copy layout of my VGs to another machine

Michael,

How do i safely copy the VG's configs? Because by using vgexport, i will be removing my VGs?

Thanks,
Charlie
Ian Dennison_1
Honored Contributor

Re: shortcut to copy layout of my VGs to another machine

Safely copy them by using the "-p" option of "vgexport".

I would also suggest if you are relocating disks you familiarise yourself with the "vgchgid" command (no man page available on this one). There are plenty of posting available on this topic, and when done right, it can save you a heap of time and hassle.

Share and Enjoy! Ian
Building a dumber user
Michael Tully
Honored Contributor
Solution

Re: shortcut to copy layout of my VGs to another machine

on server A

vgexport -m vgxx.mapfile -s -p -v /dev/myvg
If you use the -p (preview option) you are just capturing the information of the VG, not removing it. You can then ftp it to the other system.

on system B if you ever needed to import them after obviously moving the physical disk array or cables or whatever:
mkdir /dev/vgxx
mknod /dev/vgxx/group c 64 0x020000
vgimport -m vgxx.mapfile -p -v /dev/myvg (preview)
If really doing it, drop the -p option.

The man pages actually explain some of this stuff.
HTH
Anyone for a Mutiny ?
Shaikh Imran
Honored Contributor

Re: shortcut to copy layout of my VGs to another machine

Hi,
Use vgexport with -m option
this will create a map file and then copy this map file to the other server where you are connecting the disk then use vgimport and give the path of the same map file.

see man vgimport & man vgexport for more details.

Regards,

I'll sleep when i am dead.
Dietmar Konermann
Honored Contributor

Re: shortcut to copy layout of my VGs to another machine

Well, all suggesttions to use vgexport/vgimport "move" the VGs to the other system... I assume you really mean "copy", i.e. having VGs with identical layout on another system with it own set of disks?

There is no safe shortcut to do that. Of course you could replicate the disks using dd(1), then change the VGID using vgchgid(1M) and vgimport(1M) that copied disks on the other system... but the only "official" approach would be creation from scratch.

Best regards...
Dietmar.
"Logic is the beginning of wisdom; not the end." -- Spock (Star Trek VI: The Undiscovered Country)

Re: shortcut to copy layout of my VGs to another machine

Hi All,

The disks are new and not moving any disks to the new machine. I only need to copy the layout of the many VGs from the old machine to the new machine. I think Michael's suggestion is ok.

Many Thanks,
Charlie
Dietmar Konermann
Honored Contributor

Re: shortcut to copy layout of my VGs to another machine

Charlie, I don't think so. Michael wrote:

on system B if you ever needed to import them after obviously moving the physical disk array or cables or whatever

So that procedure is more moving disks. The vgimport/vgexport DOES NOT change a single bit on the disks.
"Logic is the beginning of wisdom; not the end." -- Spock (Star Trek VI: The Undiscovered Country)
Bill Hassell
Honored Contributor

Re: shortcut to copy layout of my VGs to another machine

The device files and VG directories are just pointers and flags for the driver which gets it's information from /etc/lvmtab. lvmtab is built as the vgcreate and lvcreate commands are run, but most important, the disks themselves must have special headers and extent information written on them.

The man page for vgexport is a bit confusing about -m and -s. -m specifies a specific mapfile location but unless you use -p, the vgexport will remove the VG. -s is excellent for automating restoration of a volume group because the VG serial number is added to the mapfile. However, every disk on every HP-UX box in the world should have a unique identifier (serial number) so the -s option restricts the mapfile to restoring back the the same disks. -s is mostly used in shared disks that are part of a Service Guard cluster.

The mapfile is a plain ASCII file with the minor number (last digits) and lvol name. If -s is used, the file begins with the serial number of the VG. But from the man page for vgimport:

"vgimport assumes that the volume group information has already been created on the physical volumes."

Hummmm, that means that blank disks on the target system will fail because they have no matching information. There are lots of possible complications if vgimport could build a new set of disks, problems like different size disks, mirroring, alternate paths).

So while you can get a list of lvols from the mapfile, you still have to use pvcreate, vgcreate and lvcreate on the target system. All the data you need is in vgdisplay including the VG name, lvol names, size of the lvols, and physical disk info. Just to make sure, I would run diskinfo on each physical disk to see how big they are compared to the target system.


Bill Hassell, sysadmin