1837981 Members
1891 Online
110124 Solutions
New Discussion

reduce file system

 
Jairo Campana
Trusted Contributor

reduce file system

as I reduce an file system:
/dev/vg01/lvol8 430080 38287 367363 9% /etc/opt/activation

reduce in :
/dev/vg01/lvol8 40960 38191 2653 94% /etc/opt/activation

reduce of 430mb in 40M
legionx
12 REPLIES 12
Craig Rants
Honored Contributor

Re: reduce file system

Do you have a question? Not sure what you want.
"In theory, there is no difference between theory and practice. But, in practice, there is. " Jan L.A. van de Snepscheut
Patrick Wallek
Honored Contributor

Re: reduce file system

What are you asking? I don't see a question anywhere?

Are you concerned with the reduction in the amount of data? If so, that is part of the risk of reducing a file system. When you reduce you are at risk of losing data.

The most risk free way to reduce an LV is to back it up (a couple of times), remove the LV, recreate the LV and then restore your data.
Uday_S_Ankolekar
Honored Contributor

Re: reduce file system


HI,

To reduce the size of the logical volume:

lvreduce -L /dev/vg##/lvol##

-USA
Good Luck..
Jairo Campana
Trusted Contributor

Re: reduce file system

my question is that steps I must follow to reduce el file system?
, only with lvreduce?
legionx
Sridhar Bhaskarla
Honored Contributor

Re: reduce file system

Hi Jairo,

I see 38MB of data on this file system. It's better to take a backup of it before you attempt to reduce the file system.

You can do it safely if you have OnlineJFS. If you don't, I insist you to take the backup, unmount the file system, use lvreduce and mount the file system back.

Online JFS,

1. Take backup
2. #fsadm -b 40960 /etc/opt/activation

Without onlineJFS

1. Take backup
2. Umount /dev/vg01/lvol8
3. lvreduce -L 40 /dev/vg01/lvol8
4. fsck /dev/vg01/lvol8
4. mount /dev/vg01/lvol8 /etc/opt/activation
5. Restore the data (if the data is corrupted)

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

Re: reduce file system

hey,

I would recommend you to backup your file system before you reduce it ! Then lvreduce it. Do an fsck after reducing the file system for any possible errors.

# lvreduce -L new_size lvname.

SW
Life is a promise, fulfill it!
Jairo Campana
Trusted Contributor

Re: reduce file system

gc1 # umount /etc/opt/activation/
sgc1 # lvreduce -L 70 /dev/vg01/lvol8
execute all steps:

Warning: rounding up logical volume size to extent boundary at size "72" MB.
Warning: The Logical Volume has a file system larger than the reduced size.
Reducing the Logical Volume will cause filesystem corruption.
When a logical volume is reduced useful data might get lost;
do you really want the command to proceed (y/n) : y
Logical volume "/dev/vg01/lvol8" has been successfully reduced.
Volume Group configuration for /dev/vg01 has been saved in /etc/lvmconf/vg01.conf
sgc1 # fsck /dev/vg01/lvol8
file system is clean - log replay is not required
sgc1 # mount /dev/vg01/lvol8

but cradled I do bdf, I continue seeing 430 Ms in the file system:
so that the modification is not updated?


sgc1 # bdf
/dev/vg01/lvol8 430080 38287 367363 9% /etc/opt/activation


legionx
Helen French
Honored Contributor

Re: reduce file system

hey,

what is the output of lvdisplay ?

Normally it's a problem while extending file systems and if not doing an extendfs after lvextend.

Some info:

http://us-support2.external.hp.com/cki/bin/doc.pl/sid=cf6e503a1ba845b77b/screen=ckiDisplayDocument?docId=200000009933331

SW
Life is a promise, fulfill it!
Sridhar Bhaskarla
Honored Contributor

Re: reduce file system

Hi Jairo,

Can you please attach lvdisplay /dev/vg01/lvol8?.

Also try unmount and mount again.

Do you have recent LVM patches?.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Rita C Workman
Honored Contributor

Re: reduce file system

I believe after you reduce the size of a lvol to a size smaller than a file system contained within the lgovical volume, you must re-create the file system.
If you were using Online JFS you could have used the fsadm command. But if using std lvm commands (as it would appear you have) you would need to do the following steps:
1. Backup up the file system
2. Umount the file system
3. Create the new smaller filesystem using newfs command. Indicate the new smaller file system size using the -s size option newfs command.
4. Re-mount file system
5. Restore the backup up file system data to the newly created file system.

That should fix ya,
Rgrds,
Rit
Gene Matusovsky
Advisor

Re: reduce file system

Jairo. There two steps to this process, 1) reduce the logical volume, which you did correctly. And 2) Reduce the filesystem.

You can reduce the filesystem with the fsadm command. To reduce your files system to 70MB, all you had to do was run the command

fsadm -b 143360 /etc/opt/activation

(The fsadm uses blocks. 1 MB = 2048 blocks, 70MB * 2048 = 143360 blocks).

Try running the fsadm command above. If you get an error message. Then try putting back your old Logical Volume Information back in. (Look in /etc/lvmconf/vg01.conf ) And run

lvextend -l 105 /dev/vg01/lvol8

(105 is your old extends of 420MB/4. There are 4MB per each extends. It is preferable to work with extends than with MB) Run the lvdisplay /dev/vg01/lvol8 to view the current extends.

If you did not modify this filesystem yet you should be able to restore. Then run the

fsadm -b 143360 /etc/opt/activation

If all else fails. Then you will need to follow the suggestions of the othe posters. Create an new small 70MB or 40MB partition, copy your data there and erase your old large partition.

Don't forgot back, back, and backup!!!!

Wodisch
Honored Contributor

Re: reduce file system

Hello Jairo,

since I do not know wether you have the "Online JFS/Advanced VxFS" installed and since you are only talking about a few MB:
- backup those few MB, perhaps just a simple "tar" to another filesystem
- unmount the filesystem to be reduced
- use "lvreduce" to shrink it as much as you want
- use "mkfs" to create a new filesystem on it
- mount it again, perhaps simply with "mount -a"
- untar the backup back to that filesystem

Estimated amount of time: 5minutes!

Good luck and merry X-mas!
Wodisc