General
cancel
Showing results for 
Search instead for 
Did you mean: 

How to reduce logical volume size?

SOLVED
Go to solution
sassou
Frequent Advisor

How to reduce logical volume size?

Hi all,

In order to reuse space in one FS we did the following:

1) we reduced the logical volume size of /dev/vgora/lvoracle (from 10Go to 3Go)

#unmount /dev/vgora/lvoracle
#lvreduce -L 3000 /dev/vgora/lvoracle
# mount /dev/vgora/lvoracle /oracle
vxfs mount: /dev/vgora/lvoracle is corrupted. needs checking
# fsck /dev/vgora/lvoracle
fsck: /etc/default/fs is used for determining the file system type
file system is larger than device
vxfs fsck: cannot initialize aggregate
file system check failure, aborting ...

Can anyone help us to fix this issue?
Many thanks

Kuzo
12 REPLIES
Marco Santerre
Honored Contributor

Re: How to reduce logical volume size?

I'll admit I'm not one that's fond of reducing FS..

In your case though, if you do have a backup I would simply re-create the whole LV and FS and restore from your backup.

As per the man page on lvreduce : The lvreduce command on a logical volume containing a file system of greater length than the size being reduced to will cause data corruption.

Cooperation is doing with a smile what you have to do anyhow.
Robert-Jan Goossens
Honored Contributor
Solution

Re: How to reduce logical volume size?

Kuzo,

Do you have a backup of that filesystem ?

If yes,

# umount /dev/vgora/lvoracle
# newfs -F vxfs /dev/vgora/rlvoracle
# mount /dev/vgora/lvoracle

restore the data to the filesystem.

Regards,
Robert-Jan
KapilRaj
Honored Contributor

Re: How to reduce logical volume size?

I hv done this .. and i think naveej could help u to resolve this.if u know where the PE's were before try to lvextend the lvol to thata disk and see if it has used the same pe's and then do an fsck and mount it ...

do u hv an old lvdisplay o/p it will help u to do this..

Kaps
Nothing is impossible
Sridhar Bhaskarla
Honored Contributor

Re: How to reduce logical volume size?

Hi Kuzo,

You will have to have OnlineJFS to reduce a filesystem.

Without onlineJFS and with your way of reducing filesystem causes data loss which has happened now.

You will need to recreate the filesystem and restore the data. You can try to revert back with "lvextend -L old_size /dev/vgora/lvoracle" and then "fsck /dev/vgora/lvoracle" (no extendfs later). But there is no guarantee.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Helen French
Honored Contributor

Re: How to reduce logical volume size?

The best way to reduce the size of a LV and FS is to backup the data and recreate the LV and create new FS on it. If you have OnlineJFS, that will help you in a better way. In that case, you can first resize and rearrange your file system and then do a lvreduce.

Since you didn't use OnlineJFS, your file system was never reduced and thus the lvreduce might have corrupted the file system. Now, all you can do is to recreate the file system (newfs) and check it with fsck. If everything is okay, mount it and restore the data.
Life is a promise, fulfill it!
Rita C Workman
Honored Contributor

Re: How to reduce logical volume size?

...follow the advice above and get yourself back to where you were (hope you backed up and the tape is good !)....

..and if you want to adjust things, consider that pvmove mentioned in the other thread. It is far better to move things around, than to reduce....

Rgrds,
Rita
Mark Grant
Honored Contributor

Re: How to reduce logical volume size?

Just to clarify what others have said above though trying to make it absolutely clear what went wrong here.

You reduced the size of the logical volume without reducing the filesystem first. Thats a bit like cutting a piece of paper in half and wondering where half the writing has gone.
Never preceed any demonstration with anything more predictive than "watch this"
SIJU JOSE
Frequent Advisor

Re: How to reduce logical volume size?

Hi

I feel if you need to recreate the filesystem with newfs and then do fsck

#newfs -F vxfs /dev/vgora/rlvoracle

HTH

Siju Jose
iminus
Frequent Advisor

Re: How to reduce logical volume size?

In HP-UX, lvreduce is dangerous, as it doesn't arrange your data which you might have data loss. I can't find a command that can restructure the filesystem before reduce it, so, it's better to create a brand new filesystem, copy your current one (if you can restore) over, then remove the current one so that you can reserve the space.
hope it helps
Bill Hassell
Honored Contributor

Re: How to reduce logical volume size?

As mentioned, lvreduce is NOT the command to use for a filesystem. lvreduce changed the size of the volume--lv commands know nothing about filesystems. They simply manipulate space. Reducing a filesystem (without losing all the data) is virtually impossible. The one exception is the latest version of OnlineJFS version 3.3. This is a priced product from HP. Without it, always treate filesystem reductions as destructive.


Bill Hassell, sysadmin
Naveej.K.A
Honored Contributor

Re: How to reduce logical volume size?

hi,

I may be late to reply to this...
but i got some different views and some different experience. i had ran into a similar thing, when i was first working on extending a filesystem.

fortunately i had the output of lvdisplay and knew how much exact number of LEs were allocated to the logical volume.

suppose the exact original number of LE is 1025. i would do something like,

#lvextend -l 1025 /dev/vgora/lvoracle
now try mounting the filesystem...
sitll not mounting
#extendfs -F vxfs /dev/vgora/rlvoracle
#fsck /dev/vgora/lvoracle
#mount /dev/vgora/lvoracle.

It worked for me...
and that time kapil saved my job!!!!!!!

with best wishes
naveej
practice makes a man perfect!!!
Mark Grant
Honored Contributor

Re: How to reduce logical volume size?

Naveej,

That MIGHT work and obviously, in your case it did and is probably worth a try. I would definately not rely on it though. I'd also be a little suspicious of my fileystem after that.
Never preceed any demonstration with anything more predictive than "watch this"