Operating System - HP-UX
1834800 Members
2785 Online
110070 Solutions
New Discussion

volume group careate and remove

 
SOLVED
Go to solution
Ammar_4
Frequent Advisor

volume group careate and remove

hi
i want to remove volume group on disk "c0t10d0"
and want to create new volume so tell me what to do


21 REPLIES 21
Juan M Leon
Trusted Contributor

Re: volume group careate and remove

You have to do vgremove {VolumeGroup}. Make sure it is a single disk on the volume group, if not you will need to do vgreduce {VolumeGroup} /dev/dsk/c#t#d#

hope it helps
Ammar_4
Frequent Advisor

Re: volume group careate and remove

why we use vhchange infact i am newcomer
Alan Meyer_4
Respected Contributor

Re: volume group careate and remove

do you wish to remove c0t10d0 from the volume group? or remove the volume group which contains c0t10d0???

To remove the volume group simply enter

vgremove vgname

To remove teh device from the volume group, use pvdisplay -v to make sure that there is no data on the physical device

pvdisplay -v /dev/dsk/c0t10d0

All extents should be free

Then remove it from the volume group with the vgreduce command

vgreduce vgname /dev/dsk/c0t10d0



To create a new volume group enter

vgcreate vgname /dev/dsk/c0t10d0

Good luck.

" I may not be certified, but I am certifiable... "
Juan M Leon
Trusted Contributor

Re: volume group careate and remove

vgchange is used to deactivate the volume group.
vgchange -a n VolumeGroup

-a n =Deactivate the VG
-a y =Activate the VG
Alan Meyer_4
Respected Contributor

Re: volume group careate and remove

vgchange is used to make the volume group active or inactive on the current system.

vgchange -a y vgname

makes the VG active

vgchange -a n vgname

makes it inactive.
" I may not be certified, but I am certifiable... "
Mel Burslan
Honored Contributor

Re: volume group careate and remove

you need to know which volume group is sitting on this disk first.

first you need to unmount every filesystem sitting on this volume group using umount commands as many times as necessary
(hint: man umount)

then you will remove the logical volumes by using lvremove
(hint: man lvremove)

then you can remove the volume group using vgremove
(hint: -guess what ? man vgremove)

then
rm -r /dev/volumegroup_name

# pvcreate -f /dev/rdsk/c0t10d0
# mkdir /dev/vgnew
# mknod /dev/vgnew/group c 64 0x050000
(note the number 05 immediately follwing letter x. It should be a unique number and can not exceed hexadecimal digit "a" without modifying the default kernel)
# vgcreate /dev/vgnew /dev/dsk/c0t10d0

then you can create nev logical volumes using lvcreate command as in the follwing example

# lvcreate -L 1000 -n lvol1 /dev/vgnew
# newfs -F vxfs /dev/vg00/rlvol1
# mkdir /test
# mount /dev/vgnew/lvol1 /test

hope this helps
________________________________
UNIX because I majored in cryptology...
Raj D.
Honored Contributor
Solution

Re: volume group careate and remove

Hi Amar ,

To remove the volume group on c0t1d0 , you have to :

1. check #pvdisplay -v /dev/dsk/c0t1d0
2. unmount all the filesystems on it.
# umount /fsname
3. Remove the lvol 's.
#lvremove -f /dev/vgname/lvolname [ it will remove data, ]
4. Remove the VG ,
# vgremove vgname
------------------------

to create :
1. pvcreate /dev/rdsk/c0t1d0
2. mkdir /dev/vgnew
3. mknod /dev/vgnew/group c 64 0x0N0000 [ N must be unique number , that is not used , check with # ls -l /dev/*/group ]
4. vgcreate /dev/vgnew /dev/dsk/c0t1d0

5. Now you can create LV on this.
# lvcreate -L100 -n lvol1 /dev/vgnew

6. create a FS.
# mkfs -F vxfs /dev/vgnew/rlvol1

7. Add the mount entry in /etc/fstab .
-------------------

cheers ,
Raj.
" If u think u can , If u think u cannot , - You are always Right . "
Uday_S_Ankolekar
Honored Contributor

Re: volume group careate and remove

Volume Group Creation

Identify the disk(s) to be in the VG.
# pvcreate dev/rdsk/cntndn and for all the disks that will be part of this VG
# mkdir /dev/vgnn
# mknod /dev/vgnn/group c 64 0x0n0000
creat vgnn by
# vgcreate /dev/vgnn /dev/dsk/cntndn to all the disks
# lvcreate -L -n lvname /dev/vgnn
and then it

IF you want to remove entire VG then use vgremove command
First remove each lvols

lvremove /dev/vgnn/lvoln
Then reduce vg by taking out each disk

vgreduce /dev/vgnn /dev/dsk/diskname

then vgremove /dev/vgnn

see man pages for all the commands given here. If you have any valuable data take backup first.
Good Luck..
Ammar_4
Frequent Advisor

Re: volume group careate and remove

what is the use of vgexport command
some body tell me that for practicing for your course you first do vgchange and then vgexport and i want to remove volumegroup on that disk c0t10d0
saju_2
Respected Contributor

Re: volume group careate and remove

Hi

Before removing vg from the disk make sure the data in the disk is not required or alreday backed up.

execute a pvdisplay -v /dev/dsk/c0t10d0
verify there is no LE mapping to the PE. If there is a mapping do a
pvmove /dev/dsk/c0t10d0 /dev/dsk/c0t2d0
then
vgreduce vgname /dev/dsk/c0t10d0
IF there is alternate link for the PV do a vgreduce for that PV also

When creating a new vg

pvcreate -f /dev/rdsk/c0t10d0 (-f used since alreday some vginfo is there in the PV)

mkdir /dev/newvgname
mknod /dev/newvgname/group c 64 ---minor number should be unique in the server
vgcreate newvgname /dev/dsk/c0t10d0

regards
CS


Ammar_4
Frequent Advisor

Re: volume group careate and remove

lvremove command give that out put

lvremove: Couldn't delete logical volume "/dev/vgammar/swap":
The specified logical volume is open, or
a sparing operation is in progress.
Volume Group configuration for /dev/vgammar has been saved in /etc/lvmconf/vgammar.conf
hp03/home/ammar $ cal volume "/dev/vgammar/swap": <
> The specified logical volume is open, or
> a sparing operation is in progress.Volume Group configuration for /dev/vgammar has been saved in /etc/lvmconf/vgammar.conf

> ammar has been saved in /etc/lvmconf/vgammar.conf <
> lvremove: Couldn't delete logical volume "/dev/vgammar/swap":
a sparing operation is in progress.
Volume Group configuration for /dev/vgammar has been saved in /etc/lvmconf/vgammar.conf
sh: lvremove:: not found.
hp03/home/ammar $ The specified logical volume is open, or
sh: The: not found.
hp03/home/ammar $ a sparing operation is in progress.
sh: a: not found.
hp03/home/ammar $ /dev/vgammar has been saved in /etc/lvmconf/vgammar.conf <
sh: Volume: not found.
hp03/home/ammar $ sudo lvremove -f /dev/vgammar/swap
lvremove: Couldn't delete logical volume "/dev/vgammar/swap":
The specified logical volume is open, or
a sparing operation is in progress.
Volume Group configuration for /dev/vgammar has been saved in /etc/lvmconf/vgammar.conf
h
Juan M Leon
Trusted Contributor

Re: volume group careate and remove

What does the swapinfo -a shows on your server.
why is swap under different vg group
Ammar_4
Frequent Advisor

Re: volume group careate and remove

i create it only to check it now want to remove
hp03/home/ammar $ sudo swapinfo -a
Kb Kb Kb PCT START/ Kb
TYPE AVAIL USED FREE USED LIMIT RESERVE PRI NAME
dev 524288 0 524288 0% 0 - 1 /dev/vg00/lvol2
dev 49152 0 49152 0% 0 - 1 /dev/vgammar/swap
reserve - 136240 -136240
memory 185572 87088 98484 47%
saju_2
Respected Contributor

Re: volume group careate and remove

Hi

Execute a swapinfo and check whether the disk is in use as swap. This error comes when either the disk is used for continuous usage..
swapinfo will give the lvol used as swap. Check whether the vg u r trying to remove is having any lvol configured as swap

Regards
CS
saju_2
Respected Contributor

Re: volume group careate and remove

Hi

From sam u can remove the allocated swap

sam...disks and file systems..swap..

regrads
cs
Juan M Leon
Trusted Contributor

Re: volume group careate and remove

also try lvlnboot -v this command will tell you which is the primary swap.
Ammar_4
Frequent Advisor

Re: volume group careate and remove

yes i want to remove that
/dev/vgammar/swap
where swap is a logical volume and below is the output of swapinfo -a


Kb Kb Kb PCT START/ Kb
TYPE AVAIL USED FREE USED LIMIT RESERVE PRI NAME
dev 524288 0 524288 0% 0 - 1 /dev/vg00/lvol2
dev 49152 0 49152 0% 0 - 1 /dev/vgammar/swap
reserve - 136240 -136240
memory 185572 87088 98484 47%

Juan M Leon
Trusted Contributor

Re: volume group careate and remove

you will need to modify the /etc/fstab (remove the entry for the second swap) then you will have to reboot the server no choice
Raj D.
Honored Contributor

Re: volume group careate and remove

Hi Amar ,

This is the Logical Volume name of the swap , showing in swapinfo,

/dev/vgammar/swap

Cheers,
Raj.
" If u think u can , If u think u cannot , - You are always Right . "
Raj D.
Honored Contributor

Re: volume group careate and remove

To remove the /dev/vgammar/swap lvol , you have to do:
1.remove the entry from /etc/fstab
2. shutdown -r -y 0
3. lvremove -f /dev/vgammar/swap

otherwise no way..

Cheers ,
Raj.

" If u think u can , If u think u cannot , - You are always Right . "
Ammar_4
Frequent Advisor

Re: volume group careate and remove

Thanks to all of you