Operating System - HP-UX
1833188 Members
2891 Online
110051 Solutions
New Discussion

Re: taking a physical volume out of a volume group..

 
James Hamilton_6
Occasional Advisor

taking a physical volume out of a volume group..

Hi,

I have a faulty disk that I need to remove.

The disk is one of two physical disks in a single volume group (vg02) with a single logical volume (lv11). I have found that I don't need the space offered by the disk, so I want to just remove it and throw it away.

I have enough disk space on a second volume group (vg03) to put all the data from vg02 temporarily if necessary:

# bdf
/dev/vg03/lv12 17391900 7776629 7876081 50% /pf/index
/dev/vg02/lv11 34783776 5719763 25585635 18% /pf/db

How do I go about moving the data off of the faulty disk, removing the faulty disk from vg02, then recovering vg02 with just a single physical disk?

Many thanks for your help in this matter, I hope I have been clear.

Regards
James.
20 REPLIES 20
Karthik S S
Honored Contributor

Re: taking a physical volume out of a volume group..

vgreduce vg02 /dev/dsk/faulty_disk

vgcfgbackup vg02

-Karthik S S
For a list of all the ways technology has failed to improve the quality of life, please press three. - Alice Kahn
KapilRaj
Honored Contributor

Re: taking a physical volume out of a volume group..

Do you have a disk free ? then .....

vgextend vgXX /dev/dsk/blabla
pvmove /dev/dsk/faultydisk

vgreduce /dev/vgXX /dev/dsk/faultydisk

think abt it as pvmove may fail as u said disk is faulty !!!

If you do not have disk ...go for a backup remove the FS then re-create it on the new vg and then restore !!

Regds,

Kaps
Nothing is impossible
Mark Grant
Honored Contributor

Re: taking a physical volume out of a volume group..

If you have enough space in the volume group without the faulty disk, you simply need to reduce the file system to the size of one disk, reduce the logical volume size to take it off the faulty disk and then remove the disk. If you have OnlineJFS you can do it without even taking the filesystem off line. The steps are something like this.

Defrag the filesystem.
use "fsadm" to reduce the filesystem
"lvreduce" to reduce the logical volume so that it only uses one disk.
"vgreduce" to remove the disk from the volume group.

If your physical extents can't be just reduced off the disk, then use "pvmove" to move all the physical extents off the faulty on to the good one.
Never preceed any demonstration with anything more predictive than "watch this"
James Hamilton_6
Occasional Advisor

Re: taking a physical volume out of a volume group..

wow- thanks everyone for the speedy responses..

I have come up with the following, where c0t9d0 is the faulty disk, c0t10d0 is the good disk in vg02, both disks have 4340 LE's:

# pvmove /dev/dsk/c0t9d0 /dev/dsk/c0t10d0
# lvreduce -l 4340 /dev/vg02/lv11
# vgreduce /dev/vg02 /dev/dsk/c0t9d0
# vgcfgbackup vg02

So I:
1) move all data onto PV c0t10d0
2) reduce the logical volume in vg02 to the number of LEs on a single disk
3) remove PV c0t9d0 from the volume group
4) backup the new config.

I didn't understand what fsadm was intended to do? Is it a simpler alternative to pvmove? You implied I had to take the filesystem offline before I could do the above- what does this mean? Do I have to umount /pf/db?

Thanks a lot
James.
Mark Grant
Honored Contributor

Re: taking a physical volume out of a volume group..

James,

You won't be able to reduce the logical volume if the filesystem on it is too big. You therefore need to reduce the size of your filesystem too. If you have OnlineJFS you use "fsadm -b ", You can get the filesystem block size from "df -g".

You don't actually have to do the blocksize calculation though, you can go "fsadm -b 18432M for an 18GB filesystem.

Other than this, the steps you outline are correct.

Never preceed any demonstration with anything more predictive than "watch this"
KapilRaj
Honored Contributor

Re: taking a physical volume out of a volume group..

lvreduce !!!!!!!!!!!!!!!!!!!!!! ???????????
perform a full backup !!!

Does lvreduce has an argument for the disk ?

I don't have an hpbox in front !!!

Kaps
Nothing is impossible
Mark Grant
Honored Contributor

Re: taking a physical volume out of a volume group..

Kapil, no, it doesn't. You need to use "pvmove" to move extents from one disk to another.
Never preceed any demonstration with anything more predictive than "watch this"
James Hamilton_6
Occasional Advisor

Re: taking a physical volume out of a volume group..

Mark,

how do I know if I have OnlineJFS- and what if I don't?

James.
Karthik S S
Honored Contributor

Re: taking a physical volume out of a volume group..

swlist | grep -i onlinejfs

Online JFS comes bundled with HP-UX MCOE CDs. Or else you can purchase it from,

http://software.hp.com/portal/swdepot/displayProductInfo.do?productNumber=B3929CA

-Karthik S S
For a list of all the ways technology has failed to improve the quality of life, please press three. - Alice Kahn
Mark Grant
Honored Contributor

Re: taking a physical volume out of a volume group..

Do,

"swlist | grep -i online"

And if you have it, it will come up with something like

B3929CA B.11.11 HP OnLineJFS

If you don't have it, it's OK, you just can't do the job online and you have to unmount your filesystem first. Also, remember to de-frag your filesystem with "fsadm -e" before doing the reducing and ensure you have a backup.
Never preceed any demonstration with anything more predictive than "watch this"
Mark Grant
Honored Contributor

Re: taking a physical volume out of a volume group..

Karthik???

Is that you in that hat??
Never preceed any demonstration with anything more predictive than "watch this"
James Hamilton_6
Occasional Advisor

Re: taking a physical volume out of a volume group..

Oh, I don't have OnlineJFS, so..

# umount /pf/db
# fsadm -e /dev/vg02/lv11
# fsadm -b 18432M /dev/vg02/lv11

< as above >

# mount /dev/vg02/lv11 /pf/db

Thanks for you time and assistance..

James.
Karthik S S
Honored Contributor

Re: taking a physical volume out of a volume group..

Yeah Mark :-) ... Thanks for the thread ...!!

I love this new hat .. :-)

-Karthik S S
For a list of all the ways technology has failed to improve the quality of life, please press three. - Alice Kahn
Mark Grant
Honored Contributor

Re: taking a physical volume out of a volume group..

Looks about right to me James. Please don't forget the backup before hand!
Never preceed any demonstration with anything more predictive than "watch this"
James Hamilton_6
Occasional Advisor

Re: taking a physical volume out of a volume group..

thanks!
James Hamilton_6
Occasional Advisor

Re: taking a physical volume out of a volume group..

I don't seem to be able to do fsadm. -e is not a recognised option.. I'm running 10.20.

Is it one of the special options -o?
Mark Grant
Honored Contributor

Re: taking a physical volume out of a volume group..

Actually, I think you need OnlineJFS to do a defrag. It's been so long since I haven't had it available. Thinking about it more, you may not even be able to shrink this filesystem at all. Let me revise my advice here, at least for the filesystem bit.

Copy all your filesystem data to another filesystem on another logical volume. Verify it is OK.

Destroy the logical volume that spans the faulty disk, "vgreduce" this volume group to remove the faulty disk and then recreate the logical volume and filesystem, copy your data back. I think this might be safer.
Never preceed any demonstration with anything more predictive than "watch this"
James Hamilton_6
Occasional Advisor

Re: taking a physical volume out of a volume group..

OK,

so something like:

# cp /pf/db /pf/index/db
# umount /pf/db
# lvremove /dev/vg02/lv11
# vgreduce /dev/vg02 /dev/dsk/c0t9d0
# vgcfgbackup /dev/vg02
# lvcreate -l 4340 -n lv11 /dev/vg02
# mount /dev/vg02/lv11 /pf/db

??
James Hamilton_6
Occasional Advisor

Re: taking a physical volume out of a volume group..

then

# cp /pf/index/db /pf/db..
Mark Grant
Honored Contributor

Re: taking a physical volume out of a volume group..

Sounds perfect.

If you have more than the one file on there to copy you could use "cp -rp" to copy all the files AND preserve the permissions but it won't copy any .files though
Never preceed any demonstration with anything more predictive than "watch this"