Operating System - HP-UX
1826178 Members
2242 Online
109691 Solutions
New Discussion

Re: decrease logical volume

 
SOLVED
Go to solution
szhiyong
Frequent Advisor

decrease logical volume

Hi,

I try to use sam to decrease the logical volume. I found there is only "increase logical volume" in the sam.

Would someone please to tell me how to decrease the logical volume?

thanks a lot.

zhiyong
My life is now asking and learning, I wish It can change into replying and discussing
8 REPLIES 8
Andreas Voss
Honored Contributor
Solution

Re: decrease logical volume

Hi,

if you don't have Online/JFS you cannot shrink a log. volume / filesystem.
You have to backup the data (filesystem) of the log. volume, umount , remove log. volume, recreate log. volume with new size, make filesystem on log. volume (newfs) , mount again and restore the backuped data.

Regards
Animesh Chakraborty
Honored Contributor

Re: decrease logical volume

Hi,
#lvreduce -L (size in MB) /dev/vgxx/lvolx

LVM does not store any information about which physical extents within
a logical volume contain useful data; therefore, reducing the space
allocated to a logical volume without doing a prior backup of the data
could lead to the loss of useful data. The lvreduce command on a
logical volume containing a file system of greater length than the
size being reduced to will cause data corruption.

To reduce a logical volume being used for swap, that swap area must
not be currently in use.

See man lvreduce for details.

Cheers
Animesh


Did you take a backup?
Peter Kloetgen
Esteemed Contributor

Re: decrease logical volume

Hi,

if you don't have Online JFS, it's not possible to decrease a logical volume. You could do something instead:

make a backup of the logical volume, after that remove the old logical volume, create a new one and restore the backup into the new logical volume.

To find out, if you use Online JFS, simply have a look into your /etc/fstab.

Allways stay on the bright side of life!

Peter
I'm learning here as well as helping
Jose Juan
Advisor

Re: decrease logical volume

Hi.

# tar -c /myfs
# umount /myfs
#newfs -F vxfs -s xxxxx /dev/vg01/rmyfs
#mount /myfs
#tar -x /myfs
#bdf /myfs

with this you are reducing the file system "myfs" that is JFS (without online JFS)

#lvreduce -L xx /dev/vg01/myfs

with this terminate of reducing the logical volume. Be careful, before make the lvreduce be sure that you were reducing the file system.

Good Luck.
Jota.
K.Vijayaragavan.
Respected Contributor

Re: decrease logical volume

See the man page of command "lvreduce"

If you are not having Online JFS , reducing a logical volume will wash out the data in it.

However you can take backup and reduce the required voulume and once you have reduced it then restore from backup.

Ex.

Decrease the logical volume size by decreasing the number of logical extents allocated to it.

"lvreduce -l 100 /dev/vg01/lvol3" will reduce the logical extents allocated for /dev/vg01/lvol1 to 100 numbers.

see also the man page of command "lvdisplay" ;
to get the current characteristics of the logical voulme which includes the extent size and the current extent allocated.

-K.Vijay
"Let us fine tune our knowledge together"
K.Vijayaragavan.
Respected Contributor
Trond Haugen
Honored Contributor

Re: decrease logical volume

Of course if you have enough diskspace in the VG; create a new lvol, mount it and copy the data over, then remove the "old" lvol. remember to correct fstab.

Regards,
Trond
Regards,
Trond Haugen
LinkedIn
szhiyong
Frequent Advisor

Re: decrease logical volume

Hi,

Thanks a lot for all your help. I really appreciated it.

Have a good day.

zhiyong
My life is now asking and learning, I wish It can change into replying and discussing