Operating System - HP-UX
1834458 Members
2586 Online
110067 Solutions
New Discussion

Re: Using the Mirror Copy

 
SOLVED
Go to solution
Sundar_7
Honored Contributor

Using the Mirror Copy

Hi Experts,

I am having one doubt..

If I am having a non-root volume and

having it mirrored to some other volume.

and if one of these hard disks fails,is it

possible for us to use the data in the other

hard disk as such ...or what are the steps

to break the mirror and use the mirror copy.

Do we use lvreduce or lvremove ??

Help me out please

Sundar
Learn What to do ,How to do and more importantly When to do ?
6 REPLIES 6
MARTINACHE
Respected Contributor
Solution

Re: Using the Mirror Copy

Hi,

Supposing that lvol from /dev/dsk/c1t1d0 are mirrored on /dev/dsk/c2t2d0.

If c1t1d0 failed :

- Your data are still available from /dev/dsk/c2t2d0. Perharps you will not see that c1t1d0 is failed.
- To check if mirror copy is OK, via cron, write a script which for each logical volume do :
lvdisplay -v /dev/vgXX/lvolname |grep stale |wc -l
If answer is not 0 then your is bad !

- What you need to do if c1t1d0 failed :

DO NOT USE lvremove ! This will remove your lvol from c1t1d0 AND c2t2d0.

You can do a :
lvreduce -m 0 /dev/vgXX/lvolname /dev/dsk/c1t1d0
(or each lvol on c1t1d0)
vgreduce /dev/vgXX /dev/dsk/c1t1d0


Then when the failed disk will be replaced :
pvcreate -d /dev/rdsk/c1t1d0
vgextend /dev/vgXX /dev/dsk/vgXX
lvextend -m 1 /dev/vgXX/lvolname /dev/dsk/c1t1d0
(for each lvol)

An other method is using vgcfgrestore command.

Regards,

Patrice.
Patrice MARTINACHE
Sandor Horvath_2
Valued Contributor

Re: Using the Mirror Copy

Hi !

IF You ha hotplug disks replace the bad disk and
restore LVM data to new disk
vgcfgrestore -n vgxx /dev/rdsk/.......

and activate vg
vgchange -a y -s vgxx

syncronize VG
vgsync vgxx

regards, Saa


If no problem, don't fixed it.
CHRIS_ANORUO
Honored Contributor

Re: Using the Mirror Copy

You can use SAM to break the mirror, that is easier than line commands.
http://forums.itrc.hp.com/cm/QuestionAnswer/1,1150,0xd3a7854994d9d4118fef0090279cd0f9,00.html

http://forums.itrc.hp.com/cm/QuestionAnswer/1,1150,0x56f25f260cafd4118fef0090279cd0f9,00.html
When We Seek To Discover The Best In Others, We Somehow Bring Out The Best In Ourselves.
Sundar_7
Honored Contributor

Re: Using the Mirror Copy

Thanks to both,

Fine patrice,Thanks ..

I am having one more thing to ask on

vgcfgrestore.

If the disk with scsi id say 2 failed,then

I am replacing the disk and using the

vgcfgrestore..

then what are all the steps I have to take

care...

I) is the new hard disk that will replace

the bad one need to have the same SCSI id??

II) Do we need to run pvcreate,vgextend

lvcreate,newfs,lvextend..

I guess pvcreate and newfs should be

necessary..but what are all the commands

that we need to run if we use vgcfgrestore to

restore the volume group.

Clear me please...

Sundar

and if anyone finds time,pls mail me at

sundar_hp@indiatimes.com

Learn What to do ,How to do and more importantly When to do ?
Philip P. Hartl
Valued Contributor

Re: Using the Mirror Copy

HP has an excellent document describing what and how of disk failure in a LVM, mirror and unmirrored environment. It is:
Title : procedure for replacing an LVM disk
Date : 19971211
Type : EN
Document ID : UNX1001086

Don't take life so seriously; nobody gets out alive.
Tim Malnati
Honored Contributor

Re: Using the Mirror Copy

The lvcreate and newfs commands are not required and should not be used. The logical volume and file system already exist. Assuming you use the method that Patrice mentioned: pvcreate prepares the disk, vgextend adds the new disk to the volume group, and lvextend mirrors the existing logical volume/file system on the new drive. The lvdisplay command with the -v option will give you a better picture of what is going on (using another window session is best for this). Before you remirror the drive lvdisplay -v will display the physical extents that are associated with the logical volume. When you invoke the lvextend -m 1 command, you will see a side by side extent relationship at the physical level. Initially all the mirrored extents will show as being stale until the lvextend command cycles through all the extents and copies the data over to the new drive. After lvextend is complete, the operating system takes over to maintain both these copies current.

I have never tried to use the method that Sandor mentions. Part of the idea with mirroring is to avoid any downtime and deactivating the group requires that it not be mounted. Also, the physical scsi id (bus and target) controls the device address location. Using Patrice's method allows you to remirror any drive connected to the system. This means that you could use a spare drive in a totally different location. Mirrordisk allows you to have up to three copies of the data. You could mirror the spare immediately and then when the failed drive gets replaced you can mirror it into the arrangement and afterward break down the mirror to the spare drive. This is a better method to use (if you have a spare drive) where the primary drive is protected with a mirror during the entire recovery evolution and the i/o required to copy the extents has much less contention with any other processes accessing data from the drives at the same time.