Operating System - HP-UX
1838176 Members
3344 Online
110124 Solutions
New Discussion

removing a disk from a volume group

 
Antoon Frehe
Occasional Contributor

removing a disk from a volume group

Dear All,

I have a volume group with 5 9GB disks. One of them has crashed.

Is it possible to remove this disk from the volume group, do some kind of fsck and accept the loss of the files on one of these disks?

Thx Antoon.
7 REPLIES 7
V. V. Ravi Kumar_1
Respected Contributor

Re: removing a disk from a volume group

hi,

if u have mirrored LVs with in the VG u can remove the disk and add new disk u can retrieve the data.
use SAM to remove and add the disk from VG.

regds
Never Say No
steven Burgess_2
Honored Contributor

Re: removing a disk from a volume group

Hi

The command to remove a disk from a volume group is vgreduce

Remove physical volume /dev/dsk/c0t1d0 from
volume group /dev/vg01:

deactivate the volume group

vgchange -a n /dev/vg01

Remove the disk

vgreduce /dev/vg01 /dev/dsk/c0t1d0

reactivate the volume group

vgchange -a y /dev/vg01

HTH

Steve






take your time and think things through
steven Burgess_2
Honored Contributor

Re: removing a disk from a volume group

Hi

Of course you will need to replace the disk

Deactivate the affected volume group with vgchange ???a n /dev/vg0X.

Restore the volume group config to the new disk with vgcfgrestore ???n /dev/vg0X /dev/dsk/cXtXdX .

Reactivate the volume group: vgchange ???a y /dev/vg0X.

Recreate the filesystems on the logical volumes with newfs ???F vxfs /dev/vg0X/rlvolX. Note that the raw device rlvol is used when creating the filesystem.

Mount the filesystems with mount ???a. bdf should now show all filesystems mounted and ready for data to be restored.

HTH

Steve
take your time and think things through
AUJ
Advisor

Re: removing a disk from a volume group

Hi,

The command to remove a disk from a Vol Grp is VGREDUCE.

Remove physical Volume /dev/dsk/cXtXdX from volume group /dev/vgXX:

Unmount all Log. Vol to VG.
umount /filesystem

Deactivate the VG
vgchange -a n /dev/vg01

If you want to create a mapfile, run vgexport:
vgexport -p -m vgXX

Remove the disk: vgreduce /dev/vgXX /dev/dsk/cXtXdX

Reactivate the VG
vgchange -a y /dev/vgXX

mount the filesystem.

Hope that helps.

AUJ
MANOJ SRIVASTAVA
Honored Contributor

Re: removing a disk from a volume group

Hi Antoon

If the disk is crashed than you cant recover any dat in that disk , only possisibilty is that the lvols builts on that disk donot have any data
.
To remove the disk do likt this

vgchange -a n /dev/vg01
vgreduce /dev/vg01 /dev/dsk/c1t1d1
vgchange -a y /dev/vg01


and you are good to go.


Manoj Srivastava
Shahul
Esteemed Contributor

Re: removing a disk from a volume group

Hi

HDD crashed means? pvdisplay is working for this HDD. If yes, U can see what are all lvols sharing this HDD. U may loose those datas if U have not mirrored those lvols. I will give U the both options here.

Remove the Defective disk physically from BOX. Then Add the new HDD with the same target ID. Then

#ioscan -fnC disk

Make sure that newly added HDD is getting detected. Then

#diskinfo /dev/rdsk/cxtxdx

Confirme the HDD is the same or not. Then

#pvcreate -f /dev/vdsk/cxtxdx

Here U should be very carefull. Because if U wrongly type the device file, U will loose the whole data of that HDD. Then

#vgchange -a n /dev/vgxx
#vgcfgrestore -n /dev/vgxx /dev/dsk/cxtxdx

This will restore the whole VG information to this HDD.

#vgchange -a y /dev/vgxx

If this vg is a mirrored one, do a #vgsync here. If not mirrored

U will have to create filesystems for the lvols which are there in this HDD.


Best of luck
Shahul
PIYUSH D. PATEL
Honored Contributor

Re: removing a disk from a volume group

Hi,

One thing is very important that if the disk which has failed has a filesystem which is distributed on it and the other disk also then you will be unable to retrieve the data for that filesystem. But if that disk had a filesystem and not spanning across any disks then you will have to restore the data for that filesystem only.

You can first remove the faulty harddisk from the vg.

First deactivate the vg if it is activated.
#vgchange -a n /dev/vg02
Then remove the faulty hdd from the vg
#vgreduce /dev/vg02 /dev/dsk/c2t2d0

If you had the configuration of this vg stored somewhere in the map file then you can use that after adding the new hdd to the system.

remeber to keep the same scsi id for the new hdd so that it will create the same device file for you /dev/dsk/c2t2d0

#pvcreate -f /dev/rdsk/c2t2d0
#vgextend /dev/vg02 /dev/dsk/c2t2d0

( or else after doing pvcreate do
#vgcfgrestore -m mapfile /dev/vg02

Then activate the vg
#vgchange -a y /dev/vg02

Then do a vgdisplay -v /dev/vg02 and see whether all hdd are there and all lvols are there.

Then you can create a new filesystem on the lvol where the new hdd has been installed.

Mount the filesystem and then restore your data into it.

Piyush