cancel
Showing results for 
Search instead for 
Did you mean: 

Reverse lvextend

 
SOLVED
Go to solution
Matt Wardle
Advisor

Reverse lvextend

Silly old me. Lventended filesystem without specifying the physical volume. Now it's extended on the wrong disk. I have not run fasdm -b yet to extend the filesystem, so can I just lvreduce the extents I just lvextended back to it's original size?
Or is there a risk the lvreduce will remove part of the original filesystem?

Cheers.

Matt.
6 REPLIES 6
Bharat Katkar
Honored Contributor

Re: Reverse lvextend

Matt,
There are chances that you will be able to keep you data intact but it is not guranteed. I did it and i had my data intact. But it is always safe to have backup ready. If it works safely you save your restore time. That's all.
All the best.
Regards,

You need to know a lot to actually know how little you know
Pete Randall
Outstanding Contributor

Re: Reverse lvextend

Matt,

It's worth a try, I suppose, but make absolutely sure you've got a good backup first. From the man page:

WARNINGS
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.


Pete

Pete
Wim Rombauts
Honored Contributor

Re: Reverse lvextend

Absolutely !

First be sure that your filesystem has not been extended by some automatic procedure. Compare bdf and lvdisplay output.
Then lvreduce the LV to the size of your filesystem. This is of no risk since there is actually nothing at all on that portion of the disk.
The lvextend again and fsadm your filesystem.

I have even lvreduced LV's after having to shrink a filesystem with fsadm. All without problem, as long as the new size of lvreduce is not smaller that the size of uyour filesystem.
Sunil Sharma_1
Honored Contributor
Solution

Re: Reverse lvextend

Hi,

I will use pvmove instaed of lvreduce and lvextend.This is absolute tested method. suppose you extend /dev/vg00/lvol6 to /dev/dsk/c0t1d0 but you want it to be on /dev/dsk/c0t2d0 then syntax will be like this
#pvmove -n /dev/vg00/lvol6 /dev/dsk/c0t1d0 /dev/dsk/c0t2d0


Sunil
*** Dream as if you'll live forever. Live as if you'll die today ***
Highlighted
John Palmer
Honored Contributor

Re: Reverse lvextend

Yes, you can lvreduce back to the original,no problem (just get the original size correct!). Or you could pvmove the misplaced new extents onto the correct disk.

Regards,
John
Matt Wardle
Advisor

Re: Reverse lvextend

Thanks!

Excellent replies everyone.

I forgot about pvmove, d'oh! Think I'll go with that for now, as it's less scary.

Cheers,

Matt.