Operating System - HP-UX
1826497 Members
2854 Online
109692 Solutions
New Discussion

Increase and decrease the LVM

 
augusto cossa
Frequent Advisor

Increase and decrease the LVM

Good Day,

I have a disk with the below information:

#lvdisplay -v
VG Name /dev/vg01
VG Write Access read/write
VG Status available
Max LV 255
Cur LV 2
Open LV 2
Max PV 16
Cur PV 1
Act PV 1
Max PE per PV 2171
VGDA 2
PE Size (Mbytes) 4
Total PE 2170
Alloc PE 2048
Free PE 122
Total PVG 0

--- Logical volumes ---
LV Name /dev/vg01/lvol11
LV Status available/syncd
LV Size (Mbytes) 4096
Current LE 1024
Allocated PE 1024
Used PV 1

LV Name /dev/vg01/lvol12
LV Status available/syncd
LV Size (Mbytes) 4096
Current LE 1024
Allocated PE 1024
Used PV 1


--- Physical volumes ---
PV Name /dev/dsk/c0t12d0
PV Status available
Total PE 2170
Free PE 122

#bdf
/dev/vg01/lvol12 4103345 798241 2894769 22% /data0
/dev/vg01/lvol11 4103345 194876 3498134 5% /archive

what I need is to change the size of /dev/vg01/lvol12 to 2GB and add it to /dev/vg01/lvol11.

Help on it please.
Thanks,
Augusto
5 REPLIES 5
KwangHee Yi
Advisor

Re: Increase and decrease the LVM

Unfortunately, you can't reduce logical volume size without recreating it.
At first, backup data of directory /data0 and /archive. And then unmount those directories. After this, you can delete those lvols with command lvremove.
Recreate lvol as the size what you want.
Stefan Farrelly
Honored Contributor

Re: Increase and decrease the LVM


The only way to achieve what you want on-the-fly (without having to backup your data, recreate the lvols to the desired size and reload) is by purchasing and installing OnlineJFS 3.3 This allows you to resize on-the-fly, but, if any data is on the 2Gb part of the filesystem you are trying to freeup it will move the data to part of the disk which you are keeping, which is nice and safe. Ive used it here, works fine.
Using the normal OnlineJFS (not ver 3.3) when you try to reduce your 4Gb lvol to 2Gb on-the-fly it may not be able to if any data is on the 2Gb you are trying to freeup, so this may not work.
If you unmount the lvols and try to do lvreduce it will warn you that if data is on the 2Gb you are tying to free up you will lose it - so this is not safe either.
Im from Palmerston North, New Zealand, but somehow ended up in London...
Manju Kampli
Trusted Contributor

Re: Increase and decrease the LVM

First take the backup of (/dev/vg01/lvol12) /data file system. and umount the file system. remove the /dev/vg01/lvol12.
Create /dev/vg01/lvol12 with 2Gb space and create the file system. Mount the file system and restore the data. If things are working, then unmount the (/dev/vg01/lvol11) /archive file system. extend the logical volume /dev/vg01/lvol11 and extend the file system.

the steps are like this.
1. Backup
2. Umount /data0
3. lvremove /dev/vg01/lvol12
4. lvcreate -n lvol12 -L 2000 /dev/vg01
5. newfs -F vxfs /dev/vg01/rlvol12
6. mount /data0
7. restore and check
8. umount /archive
9. lvextend -L 6000 /dev/vg01/lvol11
10. extendfs -F vxfs /dev/vg01/rlvol11
11. mount /archive

hope this helps you
Never stop "LEARNING"
Richard Mertz
Regular Advisor

Re: Increase and decrease the LVM

If the amount of system down time is important and you do not have OnlineJFS and you have enough disk space to create additional logical volumes to meet your needs, create new lvs of the size you want on new mount points. Copy the original data to the new mount points, unmount the original lvs and the newly created lvs. Mount the newly created lvs to the "original" mount points.

Richard
What anybody thinks of me is none of my business.
James R. Ferguson
Acclaimed Contributor

Re: Increase and decrease the LVM

Augusto:

If you have online JFS you MAY be able to dynamically reduce the size of your logical volume. The fsadm command is used for this purpose. This is not guarenteed to work if the file system is heavily fragmented. It is sometimes possible to defragment extents and directories first and then consolidate space when consolidation alone doesn't work. See man pages for fsadm.

...JRF...