Operating System - HP-UX
1832505 Members
4538 Online
110043 Solutions
New Discussion

Reducing size of logical volume

 
SOLVED
Go to solution
Olga_1
Regular Advisor

Reducing size of logical volume

I need to reduce the size of two logical volumes:

Here is the output of the bdf:

/dev/vg06/lv_u18 10240000 2362464 7631398 24% /mss
/dev/vg06/lv_u17 10240000 1050932 8901964 11% /home

This is what I am going to do:
1. Ensure no-one is using the filesystem (fuser or lsof)
2. backup data
3. vgcfgbackup /dev/vg06
4. umount /dev/vg06/lv_u17
5. umount /dev/vg06/lv_u18
6. lvreduce -L size /dev/vg06/lv_u17
7. lvreduce -L size /dev/vg06/lv_u18
8. newfs -F vxfs /dev/vg_06/rlv_u17
9. newfs -F vxfs /dev/vg_06/rlv_u18
10. fsck /dev/vg_06/lv_u17
11. fsck /dev/vg_06/lv_u18
12. mount /dev/vg_06/lv_u17 /home
13. mount /dev/vg_06/lv_u18 /mss
14. vgchange -a n vg06
15. vgcfgrestore ???n /dev/vg06 ???l /dev/rdsk/c9t1d0

Did I miss anything? Thank you for any comments.
8 REPLIES 8
hpuxrox
Respected Contributor
Solution

Re: Reducing size of logical volume

Steps 3,10,11,14 and 15 are not needed
John Palmer
Honored Contributor

Re: Reducing size of logical volume

Hi Olga,

No, you haven't missed anything. In fact you've got a few extra steps:

3. Will get done anyway when you do lvreduce.
10 and 11 aren't required.
14. Isn't required and won't work anyway as the VG is in use.
15. Definitely isn't required.

Regards,
John
Helen French
Honored Contributor

Re: Reducing size of logical volume

Hi Olga:

I see some problems here:
1) why using vg_06 with newfs ?
2) what is vg_06 ? is it another VG ?
3) why using vgcfgrestore ?
4) As you are recreating the file systems, why don't you consider lvremove and then lvcreate ?

I would do the following:
1) Backup data of both file systems
2) Unmount both (umount)
3) lvremove both file systems
4) Create new filesystems with same name and new(reduced) size - lvcreate
5) newfs both file systems
6) mount both
7) restore data from backup

HTH,
Shiju
Life is a promise, fulfill it!
James R. Ferguson
Acclaimed Contributor

Re: Reducing size of logical volume

Hi:

Aside from specifying size parameter (which I assume you skipped for brevity), you do not need to 'fsck' your new filesystems (steps 10-11) nor do you need to make the volume unavailable (step-14) and you do *not* want to restore the old LVM information (step-15).

You probably meant step-15 to be 'vgcfgbackup', but this is automatically the default during LVM maintenance, so it is probably superflous. See the man pages for 'lvreduce', for instance.

Regards!

...JRF...
Sandip Ghosh
Honored Contributor

Re: Reducing size of logical volume

What ever you have written is perfect. You dont need 11 and 12. And I dont know why you want to perform 14 & 15. If you want to takeout some disk from the volumegroup then look at the content of the disk, do a vgreduce for that disk and do a vgcfgbackup when everything is over. When you do the vgreduce it will automatically take the backup. So you need not to do the vgcfgbackup.

Sandip
Good Luck!!!
S.K. Chan
Honored Contributor

Re: Reducing size of logical volume

First of all make sure you have the latest LVM cumulative patches installed.

Step 1 & 2 OK
3. vgcfgbackup /dev/vg06
==> Check /etc/lvmconf/vg06.conf
Step 4,5,6,7,8 & 9 OK
Step 10 & 11 (the fsck), in my opinion is not necessary because you're newfs'ing those FS.
I assume typo error here "vg_06"
Step 12 & 13 OK (typo ?)
Step 14 & 15 not needed since you're not replacing the PV.

Sachin Patel
Honored Contributor

Re: Reducing size of logical volume

Hi,

You don't need couple steps 3,10,11.
I think you have miss type vg_06 on step 12 & 13.
Step 14 is not require and it is at worng place it will not work because you have already mount it.

Sachin
Is photography a hobby or another way to spend $
Victor BERRIDGE
Honored Contributor

Re: Reducing size of logical volume

Hi,
And if you have online-JFS you could do alternatively:
-> bdf
Filesystem kbytes used avail %used Mounted on
/dev/vg00/lvol3 307200 45286 245548 16% /
/dev/vg00/lvol1 199381 47039 132403 26% /stand
/dev/vg00/lvol7 2048000 111154 1815936 6% /var
/dev/vg00/lvol8 2048000 1606 1918502 0% /var/adm/crash
/dev/vg00/lvol6 1536000 760116 727395 51% /usr
/dev/vg00/lvol5 500000 1402 467500 0% /tmp
/dev/vg00/lvol9 2527232 659962 1750576 27% /opt
/dev/vg00/lvol4 512000 4473 475866 1% /home
/dev/vg00/lvol10 352256 1189 329133 0% /sm
/dev/vg00/lvol11 1024000 1357 958735 0% /tmp2

-> fsadm -b 250000 /home
fsadm: /etc/default/fs is used for determining the file system type
vxfs fsadm: /dev/vg00/rlvol4 is currently 512000 sectors - size will be reduced
vxfs fsadm: allocations found in shrink range, moving data

-> lvreduce -L 252 /dev/vg00/lvol4
When a logical volume is reduced useful data might get lost;
do you really want the command to proceed (y/n) : y
Logical volume "/dev/vg00/lvol4" has been successfully reduced.
Volume Group configuration for /dev/vg00 has been saved in /etc/lvmconf/vg00.conf
-> bdf
Filesystem kbytes used avail %used Mounted on
/dev/vg00/lvol3 307200 45286 245548 16% /
/dev/vg00/lvol1 199381 47039 132403 26% /stand
/dev/vg00/lvol7 2048000 111156 1815934 6% /var
/dev/vg00/lvol8 2048000 1606 1918502 0% /var/adm/crash
/dev/vg00/lvol6 1536000 760116 727395 51% /usr
/dev/vg00/lvol5 500000 1402 467500 0% /tmp
/dev/vg00/lvol9 2527232 659962 1750576 27% /opt
/dev/vg00/lvol4 250000 4409 230300 2% /home
/dev/vg00/lvol10 352256 1189 329133 0% /sm
/dev/vg00/lvol11 1024000 1357 958735 0% /tmp2
->

All the best

Victor