Operating System - HP-UX
1753837 Members
9564 Online
108806 Solutions
New Discussion юеВ

Re: 2 quick questions for lvm

 
Scott_20
Occasional Advisor

2 quick questions for lvm

1. lvreduce to shrink a volume. Is this all I do or is there a seperate command for the disk partition. I assume this is only the logical volume and nothing else.

2. calculating extents into gigs, ie, if I have 400 8mg extents in my vg, what does that come out to?
thanks,
I'm ok
7 REPLIES 7
Bryan D. Quinn
Respected Contributor

Re: 2 quick questions for lvm

Hello,

1. The lvreduce only reduces the logical volume. The physical volume will still belong to the volume group. To remove a physical volume from a volume group you would use the vgreduce command.

2. To calculate the gigs via extents:

400 * 8 = 3200 megs

3200/1024 = 3.125 gigs


Hope this helps!

-Bryan
Helen French
Honored Contributor

Re: 2 quick questions for lvm

If I understood correctly:

1) lvreduce is used to reduce the size of a logical volume. You need to take backup of that FS before you do this and do an fsck after. Also, if you need to partition disk with LVM, use pvcreate, vgcreate and lvcreate commands or SAM

2) On the vgdisplay -v vg_name command, if it shows total PE = 400 and PE size = 8MG, the total capacity of the Volume group is 400*8MG which is 3.2 GB
Life is a promise, fulfill it!
S.K. Chan
Honored Contributor

Re: 2 quick questions for lvm

1- You need to backup your FS, then lvreduce the LV and run newfs on the FS, finally restore the data. If you have OnlineJFS you can reduce the FS on-the-fly with lvreduce and then fsadm command.
2- 400x8=3200 (ie about 3.2GB)
Bryan D. Quinn
Respected Contributor

Re: 2 quick questions for lvm

One more thing. With the lvreduce, the logical volume will actually be reduced but not removed. To completely remove a logical volume use the lvremove command.

-Bryan
Tom Maloy
Respected Contributor

Re: 2 quick questions for lvm

1. lvreduce is just for the logical volume. If even a single extent is being used, then the command will fail. You can try

fsadm -F vxfs -b yourmbsizeM /mountpoint

where yourmbsize is the new size in MB, and the letter M is required.

2. (400 * 8) / 1024 = 3.125 GB
Carpe diem!
Caesar_3
Esteemed Contributor

Re: 2 quick questions for lvm

Hello!

1. Yes, you only reduce the voliume.
2. It's should be 3.125 GB

Caesar
James R. Ferguson
Acclaimed Contributor

Re: 2 quick questions for lvm

Hi Scott:

1. If you have a filesystem within the logical volume, you will first want do a backup of it. If you have OnlineJFS you can use 'fsadm' to attempt to shrink it. If you do not, then you must 'lvreduce' the logical volume container; 'newfs' the filesystem; and reload the (data) backup.

2. If you have 400 8-megabyte extents then you have 400*8*1024*1024/512 blocks where a block=512 bytes. If you have a filesystem equal to the size of the logical volume you can see this in a 'df -t mountpoint'.

Note that 1-megabyte is (1024*1024).

Regards!

...JRF...