Operating System - HP-UX
1748256 Members
3863 Online
108760 Solutions
New Discussion

Re: Increasing logical volume

 
SOLVED
Go to solution
Yaroki
Super Advisor

Increasing logical volume

Hello,

 

Sorry for the basic question.

Can I increase the space of  LV when it's get full?

I mean, is there a way to make space for a specific LV from another?

How?

 

BR,

 

Yali

11 REPLIES 11
Matti_Kurkela
Honored Contributor

Re: Increasing logical volume

If your VG has enough unallocated space available, extending a LV is easy.

The process has two steps: first you extend the LV, then the filesystem inside it.

 

For example, if you have /dev/vgBIG/lvSMALL mounted at /data that is currently 20 GB and you want to extend it to 40 GB (= 40960 MB):

 

If you have OnlineJFS:

 

lvextend -L 40960 /dev/vgBIG/lvSMALL
fsadm -F vxfs -b 40960m /data

 

If you don't have OnlineJFS:

lvextend -L 40960 /dev/vgBIG/lvSMALL
umount /data
extendfs -F vxfs /dev/vgBIG/lvSMALL
mount /data

 

If you don't have enough unallocated space in your VG for the extension, you must either add one or more new PVs to the VG, or delete/reduce another LV in the same VG.

 

Reducing a LV requires OnlineJFS and a very careful sysadmin: you must first reduce the filesystem, then the LV around it. If you reduce the LV more than you reduced the filesystem inside it, some of the data at the end of the filesystem will be cut off and lost. It's like the OnlineJFS extension procedure listed above, but in reverse order, and using the command "lvreduce" instead of "lvextend".

 

If you don't have OnlineJFS or want a safe way to reduce a LV: first backup the data in the LV, make sure your backup is good, then destroy the too-large LV and recreate it in smaller size. Then restore the data from the backup.

 

Usually the easiest option is to add one or more new PVs to the VG to get some unallocated space.

Add a new disk/LUN, ioscan -fnCdisk, insf, pvcreate, then vgextend.

 

If the VG is old and originally created with too small parameters (CurPV is already equal to MaxPV), then you may need to use the vgmodify command first. To see if you need to do that, check the VG parameters using the vgdisplay command.

MK
Yaroki
Super Advisor

Re: Increasing logical volume

Thank you for the reply.

Sorry for not mentioned it before but I have B.10.20 that use NFS / HFS and not JFS.

Can I use the same commands you offered?

 

Yali

 

 

Matti_Kurkela
Honored Contributor

Re: Increasing logical volume

Unfortunately, the fsadm command does not have the -b option for HFS, so you cannot extend filesystems without unmounting them. However, the extendfs command supports HFS, so you can use my "if you don't have OnlineJFS" example: just replace "extendfs -F vxfs" with "extendfs -F hfs".

 

Note that the supported maximum HFS filesystem size on 10.20 was 128 GB, and the technical maximum size is 256 GB if your system is on a suitable patch level.

 

NFS is not exactly a filesystem, but a networking protocol for sharing any Unix-type filesystem. To extend a NFS filesystem, find the NFS server host that is exporting the filesystem, then see what is the actual filesystem type on that host and what extension tools and possibilities are available on that host. Once you extend the filesystem on the NFS server, the new space should become visible on the NFS clients too.

MK
Yaroki
Super Advisor

Re: Increasing logical volume

If choose to add a physical disk (B) to this HP, can I use its space for my existence disk (A)?

How can I do it?

Please see the attached .doc file.

1. What are the command to install DISK B on the system?

2. Should I format it and open new VG like VG01? How?

3. Can I allocate free space from VG01 to a specific lv (dev/vg00/lvol9  /scc mount directory as marked on the attached file)?

4. Can the software work with the new disk?

 

Thank you,

 

Yali

 

Torsten.
Acclaimed Contributor

Re: Increasing logical volume

If you want to have more space in /vg00/lvol9 you have 2 choices:

 

1) extend vg00 with disk B and extend lvol9

 

2) create an new VG01 on disk B, create a larger LVOL and transfer the data from /vg00/lvol9 to /vg01/lvol1

 

 

It's up to you now.

 

Storing data in a non-boot VG is recommended. 


Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
Matti_Kurkela
Honored Contributor
Solution

Re: Increasing logical volume

Yes, with LVM you can have one LV start at one disk and continue to another disk. A LV can span multiple PVs within a VG, but not multiple VGs.

 

(If you're used to managing disks on Windows workstations, this will blow your mind... remember, HP-UX 9.00 could do this in year 1992, way before even Windows 95 was introduced.)

 

1.) Before adding a new disk, you should run "ioscan -fnCdisk" to see the list of existing disks.

After adding a new disk, run it again, and make sure the new disk is CLAIMED by HP-UX.

Then run "insf -Cdisk" to create device nodes for it. This command will display the device name for the disk, like /dev/dsk/cXtYdZ (and the corresponding raw device, /dev/rdsk/cXtYdZ).

You can also see the device nodes if you run the ioscan command a third time.

 

2.) If you want to extend one of your existing LVs, you must add the new disk to the same VG as the existing LV you want to extend.

pvcreate /dev/dsk/cXtYdZ
vgextend vg00 /dev/dsk/cXtYdZ

 After this, the space of the new disk will be added as free extents to vg00 (you can see this if you run "vgdisplay -v vg00"), so you can then extend /dev/vg00/lvol9 as in my earlier message.

 

Note: if your existing LV /dev/vg00/lvol9 is mirrored, you must add two new disks to vg00 before you can extend the LV.

 

3.) No, you cannot use vg01 to increase a LV that belongs to vg00: the new PV must be added to the VG that contains the LV that requires more space. If you want to extend /dev/vg00/lvol9, the new disk must be added to vg00.

 

Alternatively, if the new disk is much bigger than the existing /dev/vg00/lvol9, you could instead create a new VG with the new disk, create a new LV and filesystem on it, copy the data, then unmount /dev/vg00/lvol9 and mount the new LV in its place. This would actually be a better approach, since it will make it easier to move the data to another system when (not if) your very old and unsupported 10.20 system eventually fails.

 

The procedure for this would be: (after ioscan & insf, as in answer 1 above)

pvcreate /dev/rdsk/cXtYdZ
mkdir /dev/vg01
mknod /dev/vg01/group c 64 0x010000
vgcreate vg01 /dev/dsk/cXtYdZ
lvcreate -L <size> -n lvscc vg01
# (Replace <size> and cXtYdZ with actual values)

mkfs -F hfs -o largefiles /dev/vg01/lvscc # (or maybe use vxfs instead?) mkdir /temp_mnt mount /dev/vg01/lvscc /temp_mnt (cd /scc; tar cf - .) | (cd /temp_mnt; tar xvf -) # (the above command will copy everything on /scc to /temp_mnt, while maintaining file ownerships, permissions and timestamps) umount /temp_mnt umount /scc # <edit /etc/fstab: change the /scc line to use device /dev/vg01/lvscc instead of /dev/vg00/lvol9> mount /scc # <test to make sure everything works> rm /temp_mnt lvremove /dev/vg00/lvol9

 

 

4.) As far as the filesystem and the applications using it are concerned, "there is no new disk". The existing /dev/vg00/lvol9 will just be bigger than it was before. Each LV will behave like a single disk device, no matter how many PVs it is physically located on.

 

The same is true even if you access the LV in raw mode, using device /dev/vg00/rlvol9.

MK
Yaroki
Super Advisor

Re: Increasing logical volume

Great! many thanks for the clear detail answers!

Your explaintions makes this much easier.

 

The B disk that will be added to the system contains data.

How can I delete it or format it? shuold I do it before or after the addition?

 

You also noted that it is not a question of time that the B.10.20 will fail.

I do have also some HP-UX B.11.11 machines. Can I install one of the disk on the B.10.20 case or can I "move" the applicaion to the B.10.20?

BR,

 

Yali

Dennis Handly
Acclaimed Contributor

Re: Increasing logical volume

>can I "move" the applicaion to the 10.20?

 

Which application?  Executables for 11.11 probably won't work on 10.20.

Torsten.
Acclaimed Contributor

Re: Increasing logical volume

>> How can I delete it or format it? shuold I do it before or after the addition?

No need to format anything. "pvcreate" will prepare the disk for LVM usage.

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!