Operating System - HP-UX
1834773 Members
2968 Online
110070 Solutions
New Discussion

Re: insert new space into logical volumes from new disk

 
SOLVED
Go to solution
roberto salvatori
Frequent Advisor

insert new space into logical volumes from new disk

hi all,
yesterday on hp-ux 11 it was inserted a new disk (4,3 GB). now i need to add into my volume groups this new disk.
my situation is:
2 volume group (vg00 and vg01)
lvol2 (/util), lvol5 (/opt), lvappli (/appli), lvol3 (/).
how can i do?
thanks for your support
23 REPLIES 23
Rick Garland
Honored Contributor

Re: insert new space into logical volumes from new disk

Start with the vgextend command to the new disk. This will allow you to create the LV within the desired volume group which will be on the new disk.

vgextend /dev/vgXX /dev/dsk/cXtXdX

etc...
Kevin Wright
Honored Contributor

Re: insert new space into logical volumes from new disk

you can only add a disk to ONE VG. so decide which volume group you want to extend, then buy another disk for the other one.

pvcreate
vgextend VG01
At this point it really depends on if you have online JFS installed or not, if so

lvextend your lvols in VG01
fsadm -b /mountpoint

if not,
you'll have to unmount the filesystems, then run extendfs.
Sridhar Bhaskarla
Honored Contributor
Solution

Re: insert new space into logical volumes from new disk

Hi,

Find out the disk by using the commands

ioscan -f
insf
ioscan -fnC disk > /tmp/disk.out

Look at /tmp/disk.out and find out the device file corresponding to the path. (cxtydz).

Create PV structures on it.

pvcreate /dev/rdsk/cxtydz

Add the disk to the desired vg

vgextend vg01 /dev/dsk/cxtydz

If cxtydz has an alternate path as displayed ioscan -fnC, add it too using vgextend

Now you have 4GB available in vg01. You can use it either to extend an existing volume or create a new logical volume.

Extend an existing LV.

umount /appli
lvextend -L new_size_in_MB /dev/vg01/lvappli
extendfs /dev/vg01/rlvappli
mount /appli

Create new LV

lvcreate -n newlv -L desired_size_in_MB vg01
newfs -F vxfs /dev/vg01/rnewlv
mkdir /newdir
mount /dev/vg01/newlv /newdir
update /etc/fstab to include the new lv.

However, if you didn't have a disk equal to or more than 4GB in your volume group, you can't get 4GB out of the new disk.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
A. Clay Stephenson
Acclaimed Contributor

Re: insert new space into logical volumes from new disk

You can only add this to one of the volume groups - you decide which one.

Let's assume that you new disk is c1t5d0.

1) pvcreate -f /dev/rdsk/c1t5d0

2) vgextend /dev/vg01 /dev/dsk/c1t5d0

3) lvextend -L 1000 /dev/vg01/lvol2

(Increase lvol2 to 1000MB)

4) umount /util

5) extendfs -F vxfs /dev/vg01/rlvol2

6) mount /util.

If you have onlineJFS, you would use fsadm and extend the filesystem without unmounting.

Man pvcreate, vgextend, lvextend, extendfs, fsadm for details.


Because, you seem a bit unsure, I would suggest that you do this with SAM->Disks and Filesystems. It will guide you through the entire process.
If it ain't broke, I can fix that.
roberto salvatori
Frequent Advisor

Re: insert new space into logical volumes from new disk

if i understand, is not possible share the disk. i thought that i could share a disk into different portions (4,3GB = 4 parts of 1GB). is it true?
roberto salvatori
Frequent Advisor

Re: insert new space into logical volumes from new disk

into different volume groups, naturally
roberto salvatori
Frequent Advisor

Re: insert new space into logical volumes from new disk

into different volume groups, naturally
Robert-Jan Goossens
Honored Contributor

Re: insert new space into logical volumes from new disk

Roberto,


No you can NOT share the disk between two volume groups.

Robert-Jan.
A. Clay Stephenson
Acclaimed Contributor

Re: insert new space into logical volumes from new disk

Not with LVM; the entire physical disk can only be a member of one volume group.

One possible solution is to move some of the filesystems in vg00 to vg01. Only /stand, primary swap, and / MUST be on the boot disk. You could for example move /var to vg01 although this is considered a "non-standard" configuration.
If it ain't broke, I can fix that.
Robert-Jan Goossens
Honored Contributor

Re: insert new space into logical volumes from new disk

Roberto,

Why do want to extend / filesystem how small is it right now ?

I use 120 Mb for /

Hope it helps,

Robert-Jan.
James R. Ferguson
Acclaimed Contributor

Re: insert new space into logical volumes from new disk

Hi:

A very worthwhile read to aquaint yourself with basic LVM and filesystem management concepts and techniques can be found in chapter-6 of "Managing Systems and Workgroups":

http://docs.hp.com/hpux/onlinedocs/B2355-90742/B2355-90742.html

Regards!

...JRF...
roberto salvatori
Frequent Advisor

Re: insert new space into logical volumes from new disk

u are right james and u must know that i have all hp-ux manuals but, like all, i have no time to read. i know that i must read its to know. one day will be. thanks for all
roberto salvatori
Frequent Advisor

Re: insert new space into logical volumes from new disk

i've just added a disk to vg00 volume group. now i'm preparing to add a disk into a logical volume. but i think there is a little problem:
the logical volume that i must extend are:
/
/home
/usr
/var
/stand
the question is: i don't think that i can umount these mount points. true? what can i do to do this? i must reboot a machine and put it on single mode? or something else?
James R. Ferguson
Acclaimed Contributor

Re: insert new space into logical volumes from new disk

Hi (again):

You are not going to be able (easily, if at all) to extend '/stand' or '/'. As for the others you will need to boot up into single-user mode if you don't have Online JFS licensed.

If you truly want to enlarge all of these, I suggest/urge you to download a current version of Ignite; create a 'make_tape_recovery' tape; boot from it; choose "advanced installation" and resize your vg00 logical volumes during the reinstallation.

Regards!

...JRF...
Sridhar Bhaskarla
Honored Contributor

Re: insert new space into logical volumes from new disk

Hi,

You can extend /home, /usr, /var while you are in single user mode. Use /sbin/lv* commands for this purpose.

If it is really required to extend / and /stand, I suggest you go through "make_tape_recovery" process. There are work arounds to increase /stand and /. Since you are novice to LVM, I would suggest you first create "make_tape_recovery" tape. Re-install the OS using this tape. During the installation, it will allow you to resize the sizes.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
roberto salvatori
Frequent Advisor

Re: insert new space into logical volumes from new disk

no, i'm not so sure to do this and i've changed idea.
i wanna show u what is the situation on my machine:
itdevux:root: /# bdf
Filesystem kbytes used avail %used Mounted on
/dev/vg00/lvol3 307200 269485 35388 88% /
/dev/vg00/lvol1 99669 24120 65582 27% /stand
/dev/vg00/lvol8 1048576 785300 246965 76% /var
/dev/vg01/lvvardeo 258048 39343 205070 16% /var/deotrans
/dev/vg01/lvvarap 1536000 1125291 385247 74% /var/appli
/dev/vg02/lvol2 409600 253896 146586 63% /util
/dev/vg00/lvol7 819200 645481 162877 80% /usr
/dev/vg00/lvol6 536576 8317 496431 2% /tmp
/dev/vg00/lvol5 913408 643356 253228 72% /opt
/dev/vg00/lvol4 204800 129364 71045 65% /home
/dev/vg01/lvbases 180224 149962 29448 84% /bases
/dev/vg01/lvtpc 2093056 43057 1921967 2% /bases/travail/PC
/dev/vg01/lvtrhr 2097152 221303 1758647 11% /bases/travail/HR
/dev/vg01/lvcpc 46080000 39793737 5893478 87% /bases/donnees
/dev/vg01/lvbkcpc 10240000 5301203 4631975 53% /bases/backup
/dev/vg01/lvappli 4571136 3035926 1439535 68% /appli
itlabtux:/nfs/pool 4096000 1780368 2172688 45% /hpf20

itdevux:root: /# ioscan -fnkCdisk
Class I H/W Path Driver S/W State H/W Type Description
=====================================================================
disk 17 8/4.2.0 sdisk CLAIMED DEVICE SEAGATE ST318436LC
/dev/dsk/c0t2d0 /dev/rdsk/c0t2d0
disk 22 8/4.3.0 sdisk CLAIMED DEVICE SEAGATE ST318436LC
/dev/dsk/c0t3d0 /dev/rdsk/c0t3d0
disk 24 8/4.4.0 sdisk CLAIMED DEVICE SEAGATE ST39173WC
/dev/dsk/c0t4d0 /dev/rdsk/c0t4d0
disk 23 8/4.5.0 sdisk CLAIMED DEVICE SEAGATE ST34573WC
/dev/dsk/c0t5d0 /dev/rdsk/c0t5d0
disk 8 8/16/5.2.0 sdisk CLAIMED DEVICE HP DVD-ROM 6x/32x
/dev/dsk/c1t2d0 /dev/rdsk/c1t2d0
disk 18 10/12.6.0 sdisk CLAIMED DEVICE SEAGATE ST34573WC
/dev/dsk/c3t6d0 /dev/rdsk/c3t6d0
disk 19 10/12.8.0 sdisk CLAIMED DEVICE SEAGATE ST39173WC
/dev/dsk/c3t8d0 /dev/rdsk/c3t8d0
disk 20 10/12.14.0 sdisk CLAIMED DEVICE SEAGATE ST318436LC
/dev/dsk/c3t14d0 /dev/rdsk/c3t14d0
disk 21 10/12.15.0 sdisk CLAIMED DEVICE SEAGATE ST318436LC
/dev/dsk/c3t15d0 /dev/rdsk/c3t15d0

the disk just added is /dev/dsk/c3t6d0.

strange for me is vg02. i don't understand why in the past they have created a volume group only for this logical volume. but it's not important this.
so what should i do is this:
1) remove the effect of the previous command (vgextend vg00 /dev/dsk/c3t6d0 and pvcreate /dev/rdsk/c3t6d0)
2) move vg02 (data and space) into vg01
3) add a disk into vg01
4) remove vg02
5) go at home cause i'm tired.
i know that is a big job but someone help me? thanks
Sridhar Bhaskarla
Honored Contributor

Re: insert new space into logical volumes from new disk

Hi,

It is not possible to directly move the data from vg02 to vg01. You will need to do this.

#pvcreate /dev/rdsk/c3t6d0
#vgextend /dev/vg01 /dev/dsk/c3t6d0
#lvcreate -n util -L 400 /dev/vg01
#newfs -F vxfs /dev/vg01/rutil
#mkdir /tempdir
#mount /dev/vg01/util /tempdir
#Cp -Rp /util/* /tempdir
#umount /util
#umount /tempdir
#mount /dev/vg01/util /util

(adjust /etc/fstab to change /util mount point)


#vgdisplay -v vg02 > /tmp/vg02.out
#lvremove /dev/vg02/lvol2
#vgchange -a n vg02
#vgexport vg02

Get the disk corresponding to vg02 from /tmp/vg02.out say c3t5d0. Add it to vg01.

#pvcreate -f /dev/rdsk/c3t5d0

You can use it either to extend vg01 or vg00.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
roberto salvatori
Frequent Advisor

Re: insert new space into logical volumes from new disk

the vgextend i made before on vg00 and when i try to extend into vg01 it says that the physical volum is already recorded in the /etc/lvmtab file. what can i do to transport from vg00 to vg01?
Sridhar Bhaskarla
Honored Contributor

Re: insert new space into logical volumes from new disk

If you haven't used the physical volume (pvdisplay -v /dev/dsk/c3t6d0 should show no logical volumes), then you can use

#vgreduce vg00 /dev/dsk/c3t6d0
#vgextend vg01 /dev/dsk/c3t6d0

If you have logical volumes, then you will need to remove them.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
A. Clay Stephenson
Acclaimed Contributor

Re: insert new space into logical volumes from new disk

That is what the vgreduce command is used for. Man vgreduce for details.
If it ain't broke, I can fix that.
James R. Ferguson
Acclaimed Contributor

Re: insert new space into logical volumes from new disk

Hi Roberto:

A friendly word of advice, if you please: You really should spend a few hours reading the document I suggested and carefully decide what you really want to achieve. You have already indicated your desire to "go home". Rushing LVM/filesystem maintenance when you are a tired novice will only lead to problems.

Regards!

...JRF...
Robert-Jan Goossens
Honored Contributor

Re: insert new space into logical volumes from new disk

Hi Roberto,

I hope you took James advice and you read this in the morning.

One other advice, tell your boss you need a HPUX training. The why is simple you need to practice the commands. The only good way is to take a training, away from your job.

Enough is enough you had a hard day yesterday.
_________
the disk just added is /dev/dsk/c3t6d0.

strange for me is vg02. i don't understand why in the past they have created a volume group only for this logical volume. but it's not important this.
so what should i do is this:
1) remove the effect of the previous command (vgextend vg00 /dev/dsk/c3t6d0 and pvcreate /dev/rdsk/c3t6d0)
2) move vg02 (data and space) into vg01
3) add a disk into vg01
4) remove vg02
_______

Before we start, be shore you have a good backup and a recent ingite tape

Note the output from

#lvdisplay -v /dev/vg00/lvol4 | lp
#lvdisplay -v /dev/vg00/lvol8 | lp
Check if these are hfs or vxfs
# vgdisplay -v /dev/vg02 | lp
Note the device file of the disk

1)
remove the effect of vgextend vg00
# vgreduce vg00 /dev/dsk/c3t6d0

2) add disk to vg01
# vgextend /dev/vg01 /dev/dsk/c3t6d0
You now have enough space in vg01 to move /util

3) move vg02 into vg01
# mkdir /bases/backup/vg02_temp
# cd /
# find /util | cpio -pcmudv /bases/backup/vg02_temp
you now have a copy of /util online.
# umount /util
# vi /etc/fstab
and comment out #/util
/bases/backup/vg02_temp
# vgchange -a n vg02
# vgremove vg02
# lvcreate -L 440 -n util /dev/vg01
# newfs -F vxfs /dev/vg01/rutil
# mount /dev/vg01/util /util
# vi /etc/fstab
and uncomment /util + change vg02 into vg01
# cd /bases/backup/vg02_temp
# find . | cpio -pcmudv /util# cd ..
# rm -r vg02_temp

After these actions you have a free disk witch used to belong to vg02. If you wish you can add this one to vg00 and extend some file systems.

Some suggestions
/
/stand
These two file sytems are the most difficult. Use an Ignite tape to extend / and /stand.

But I think your file systems are big enough
/ 300 MB
/stand /100 MB

You have to take a close look at those two.

# find / -f file -xdev -size +1000 -exec ls -l {} \;

Check if you get any files that should not be in /

The same for /stand, there are probably old files vmunix.prev which you can remove. CHECH these carefully before removing them.

Adding the free disk to vg00
#vgextend /dev/vg00 /dev/dsk/c?t?d?

/var
/home
These are a bit easier. boot into single user mode. var is a bit more difficult because you need to be in single user mode.

On the console
# shutdown -r -y 0
interrupt boot
bo pri
interact with IPL
ISL>hpux -is
var
# /sbin/lvextend -L /dev/vg00/lvol8
# /sbin/extendfs -F /dev/vg00/rlvol8
home
# /sbin/lvextend -L /dev/vg00/lvol4
# /sbin/extendfs -F /dev/vg00/rlvol4
# /sbin/mount -a
# bdf
# shutdown -r -y 0

If you still like to extend / and /stand add a new message to this forum.

Kind regards,

Robert-Jan.
roberto salvatori
Frequent Advisor

Re: insert new space into logical volumes from new disk

thank u robert, thank u all.
i will study. i promise