Thursday, July 27, 2017

# mirror disk replacement hpux # work

UNIX : How to break mirrored disks in HPUX

This is a tutorial on how to break a mirrored disk, because one of it is faulty in a RAID/array group

After the SAN team has assigned a replacement disk on the server, it is time to break the mirror and add the new PV to the VG. I trust you have taken the necessary steps for a health check, backup and raised a Change Request for the disk replacement

 1. First we break the mirrored disk

abyss[/root]# pvchange -a N /dev/dsk/c6t3d0
Warning: Detaching a physical volume reduces the availability of data 
within the logical volumes residing on that disk.
Prior to detaching a physical volume or the last available path to it,
verify that there are alternate copies of the data 
available on other disks in the volume group.
If necessary, use pvchange(1M) to reverse this operation.
Physical volume "/dev/dsk/c6t3d0" has been successfully changed.
abyss[/root]#

2. We check the PV status and it must be unavailable

abyss[/root]# pvdisplay /dev/dsk/c6t3d0
--- Physical volumes ---
PV Name                     /dev/dsk/c6t3d0
VG Name                     /dev/vg01
PV Status                   unavailable              
Allocatable                 yes          
VGDA                        2   
Cur LV                      6      
PE Size (Mbytes)            32              
Total PE                    2170    
Free PE                     0       
Allocated PE                2170        
Stale PE                    2170    
IO Timeout (Seconds)        default             
Autoswitch                  On        

Proactive Polling           On 

3. Unattached the faulty disk from disk bay and replace the disk (done onsite by engineer)

4. Once the new disk has been attached, we run the ioscan command to get the new disk name

# ioscan -fnC disk

abyss[/root]# pvcreate /dev/rdsk/c6t3d0
pvcreate: The physical volume "/dev/dsk/c6t3d0" is already recorded in the "/etc/lvmtab" file.
abyss[/root]

5. We then restore the VG and make the PV available to the VG

abyss[/root]# vgcfgrestore -n vg01 /dev/rdsk/c6t3d0
Volume Group configuration has been restored to /dev/rdsk/c6t3d0

abyss[/root]# pvdisplay /dev/dsk/c6t3d0
--- Physical volumes ---
PV Name                     /dev/dsk/c6t3d0
VG Name                     /dev/vg01
PV Status                   unavailable              
Allocatable                 yes          
VGDA                        2   
Cur LV                      6      
PE Size (Mbytes)            32              
Total PE                    2170    
Free PE                     0       
Allocated PE                2170        
Stale PE                    2170    
IO Timeout (Seconds)        default             
Autoswitch                  On        
Proactive Polling           On  

abyss[/root]# pvchange -a y /dev/dsk/c6t3d0  
Physical volume "/dev/dsk/c6t3d0" has been successfully changed.

6. Sync the VG, depending on the size of the VG, sync may take a while. As you can see the number of stale extents keeps reducing

abyss[/root]# vgsync vg01

abyss[/root]# pvdisplay /dev/dsk/c6t3d0
--- Physical volumes ---
PV Name                     /dev/dsk/c6t3d0
VG Name                     /dev/vg01
PV Status                   available                
Allocatable                 yes          
VGDA                        2   
Cur LV                      6      
PE Size (Mbytes)            32              
Total PE                    2170    
Free PE                     0       
Allocated PE                2170        
Stale PE                    2166    
IO Timeout (Seconds)        default             
Autoswitch                  On        

Proactive Polling           On


abyss[/root]# pvdisplay -v /dev/dsk/c6t3d0 | grep stale | wc -l
2111
abyss[/root]# pvdisplay -v /dev/dsk/c6t3d0 | grep stale | wc -l
2106

The stale extend will eventually zero out, so run the pvdisplay command to get your final STALE PE reading

The entire process can be done at any time, downtime is not needed. Note that I didn't use the VG deactivate/reactivate commands anywhere in this tutorial. Command tested on HPUX 11.23

No comments:

Post a Comment