1834646 Members
2074 Online
110069 Solutions
New Discussion

lvreduce - bdf

 
Konrad Hegner
Frequent Advisor

lvreduce - bdf

Hi there

I was constrained to reduce a logical volume with the command lvreduce -L 1500 /dev/vg00/lvol12.

This wasn't a problem, it was possible to gave the new space to another lvol. By the command 'lvextend', you have to use also the command 'extendfs'. After this command the display from the command 'bdf' is for the lvextendet-lvol correct, but by the lvreduce-lvol is the display still the old size.
How I can change also this display?
10 REPLIES 10
Helen French
Honored Contributor

Re: lvreduce - bdf

The normal practise for a lvreduce can be:
1) Backup file system
2) unmount file system
3) lvreduce -L new_size lvol_name
4) newfs -F FS_name rlvol_name
5) mount file system
6) Restore from backup
7) bdf
Life is a promise, fulfill it!
Konrad Hegner
Frequent Advisor

Re: lvreduce - bdf

Ok, but in this case I lose all datas from this lvol.(?)
If there no other way without losing the datas.

(I know normaly you have to do a backup, delete the lvol, create it new and restore the datas. But I look for a faster and easier way for my labor-system!)
Jerome Swiniarski
New Member

Re: lvreduce - bdf

Hi,

if you want to decrease size of filesystem online, you must install and use onelinejfs
product (not free product). With this product
you can extend or reduce a filesystem online,
with fsadm command (with -b option).
If it was the cas you'll performed:
#fsadm -F vxfs -b /mount_point
#lvreduce -L /dev/vgxx/lvolyy

Bye, Jerome Swiniarski.
Darrell Allen
Honored Contributor

Re: lvreduce - bdf

I'm afraid the filesystem on the lvol you reduced is wasted. I wouldn't trust it.

Even with Online (Advanced) JFS, reducing the size of a filesystem is problematic.

I'd say is time to get started restoring from a backup.

Darrell
"What, Me Worry?" - Alfred E. Neuman (Mad Magazine)
T G Manikandan
Honored Contributor

Re: lvreduce - bdf

if you do not have Online Jfs

Then

1. lvextend -L xxxM /dev/vgnn/XXXX
2. umount /
3. extendfs -F vxfs /dev/vgnn/rXXXX
4.mount /dev/vg01/lvhome /home

If you have OnlineJFS then

# lvextend -L xxxx /dev/vgnn/XXXX
# fsadm -F vxfs -b xxxxxx /

But both ways

###############
Backup is important
#################

Thanks
Jean-Louis Phelix
Honored Contributor

Re: lvreduce - bdf

Hello,

I think that now you have a valid filesystem (the extended one) and a corrupted one (the lvreduced one).

I can see that you know that you have the lv level and the fs level. You should have reduced also the filesystem level BEFORE reducing the lv level. From the system view all structures of the reduced lvol are the ones of the old size, but if you try to access data, you will get an IO error. If you had OnlineJFS installed, perhaps it would have been possible to do it online (especially with JFS 3.3). Without it or with HFS you have to umount the filesystem and use fsam with a smaller size.

Try a fsck on the reduced lvol but I think that you now have to use newfs after unmounting to repair.

Regards,

Jean-Louis.
It works for me (© Bill McNAMARA ...)
Bill McNAMARA_1
Honored Contributor

Re: lvreduce - bdf

lvreduce is for the lvol

fsadm, as part of onlineJFS, is the equivalent for the filesystem..

of course it's a terrible idea to do an lvreduce without doing a filesystem reduction beforehand..

Later,
Bill

It works for me (tm)
Bill Hassell
Honored Contributor

Re: lvreduce - bdf

The answer is: Online JFS which is an optional product. Even then, until you have JFS 3.3 versions, reducing a filesystem is tenuous at best and should be assumed to be a destructive event as far as the data goes. Logical volumes are not filesystems. They can contain a filesystem (or swap or raw data, etc) but there is no connection between the lvol and a contained filesystem.

An lvol is simply a container, and filesystems don't always stay at the bottom of the container. The HFS filesystem immediately places superblocks across the entire lvol when newfs (mkfs) is run, so reduction is always destructive. JFS is a bit better but without Online JFS ver 3.3, you may lose the entire directory once it is reduced.


Bill Hassell, sysadmin
Helen French
Honored Contributor

Re: lvreduce - bdf

Eventhough the best practise is to backup the file system, you could also try the fsadm option if you have online JFS installed:

# fsadm -F vxfs -b [lv_size_MB]M /mount_point (reduce file system)
# lvreduce -L [lv_size_MB] lvol_name (reduce lvol)
# bdf
Life is a promise, fulfill it!
Hamdy Al-Sebaey
Regular Advisor

Re: lvreduce - bdf

Hi,

I agree with Shiju,you most've a full back-up of this FS,then follow the steps as they are mentioned by Shiju,then restore the data from prev. back-up.

Regards,
Hamdy
Thanks for sharing knowledge