Operating System - HP-UX
1752676 Members
6420 Online
108789 Solutions
New Discussion юеВ

Re: Wants to replace a hard drive which is a part of a vg vg01

 
Amruth
Regular Advisor

Wants to replace a hard drive which is a part of a vg vg01

All,

I have 2 disks on vg vg01. Wants to replace one of the drives. The second disk has around 12 lvols..not mirrored.

As far as i know.

I need to first do vgcfgbackup the vg01

Then vgreduce the failed harddrive.

Replace the harddrive.
Do vgcfgrestore to the new drive and create the new logical volumes.

Am i correct ?

Thanks,
AM
If i am doing the same way you are doing to me then what is the difference between us.
7 REPLIES 7
Patrick Wallek
Honored Contributor

Re: Wants to replace a hard drive which is a part of a vg vg01

You should already have a vgcfgbackup, so I wouldn't worry about doing that. If the drive is truly dead, then the vgreduce will fail.

The steps I would do:

1) Replace bad drive with good drive

2) vgcfgrestore -n vg01 /dev/dsk/c?t?d?
(I think that syntax is correct, double check with the man page to verify)

3) vgchange -a y vg01

4) Check the drive to see if the vgcfgrestore re-created any LV's that were there already. If there weren't any, then create them and mount them.

5) Restore data
Steven E. Protter
Exalted Contributor

Re: Wants to replace a hard drive which is a part of a vg vg01

I like Patricks step, except I'd do a vgexport -m /etc/lvmcong/vg01.map -s /dev/vg01

You might want to use -p instead of -s because that will not actually inactivate the volume group.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Sundar_7
Honored Contributor

Re: Wants to replace a hard drive which is a part of a vg vg01

Nope, dont follow what you have suggested :-)

if you do a vgcfgbackup and then vgreduce, it effectively overrides the conf file in /etc/lvmconf, though it keeps a copy of the old configuration.

1) Shutdown and replace the drive
2) Boot the system
3) VG may not get activated if the quorum is not present
4) vgcfgrestore -n /dev/vg01 /dev/rdsk/cXtYdZ
5) vgchange -a y /dev/vg01
6) Create the filesystems on the new disk
newfs -F vxfs -o largefiles /dev/vg01/lvolXX
7) mount the lv
8) restore from the backup


- Sundar
Learn What to do ,How to do and more importantly When to do ?
Sundar_7
Honored Contributor

Re: Wants to replace a hard drive which is a part of a vg vg01

If the drives are hot swappable then

1) umount all the logical volumes of the old PV (if you still can)
2) Pull off the bad disk
3) Insert the new disk
4) do ioscan and insf -e
5) vgcfgrestore
6) Create filesystems
7) mount and restore from the backup

Learn What to do ,How to do and more importantly When to do ?
Geoff Wild
Honored Contributor

Re: Wants to replace a hard drive which is a part of a vg vg01

Hold the phone...

You say there are 2 disks in vg01 - not mirrored - and 1 has failed?

Does the one that failed have data still on it?

If so, then you will be restoring your data....

You have 2 choices - vgcfgrestore should work....

Else just re-create the volume group from scratch...


Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Simon Galton
Frequent Advisor

Re: Wants to replace a hard drive which is a part of a vg vg01

If the disk you want to replace has failed, you are likely looking a data recovery scenario.

However, assuming you simply want to replace the disk, here's a easy method.

1) Physically add the new disk to the system
2) Check that it's there: ioscan -fnC disk
3) Create the devices files (if required): insf -e
4) Initialize the disk for VG ops: pvcreate /dev/dsk/cXtYdZ
5) Add the disk to vg01: vgextend vg01 /dev/dsk/cXtYdZ
6) Move the data from the disk you want to remove to the new disk: pvmove /dev/dsk/cAtBdC /dev/dsk/cXtYdZ
7) Remove the disk you no longer want from vg01: vgreduce vg01 /dev/dsk/cAtBdC
8) Physically remove the disk you no longer want from the system

Of course, the above assumes that you can hot connect/disconnect your disks, and that you have OnlineJFS (I think pvmove is part of the optional OnlineJFS package -- if you don't have it, you don't know what you're missing!).

Good Luck!

Simon
Prashant Zanwar_4
Respected Contributor

Re: Wants to replace a hard drive which is a part of a vg vg01

You would have a config file for VG. Just keep a backup of it on safer side.

do a vgreduce using -A n option

Hope you have already though of backing up VG.

for lv in lv1 lv2 lv3 .......
do lvremove -A n $lv
vgreduce -A n vg_name pv_path
vgchange -a n vg_name

Take the system down here. Replace the disk.

Take the system up. VG wont activate it doesnt have quorum

vgcfgrestore -n /dev/vg01 raw_dev_path

and carry on the steps ahead.

Thanks
Prashant




"Intellect distinguishes between the possible and the impossible; reason distinguishes between the sensible and the senseless. Even the possible can be senseless."