Operating System - HP-UX
1833771 Members
2284 Online
110063 Solutions
New Discussion

Descrease filesystem size

 
Bruno Bossier_1
Regular Advisor

Descrease filesystem size

What is the correct procedure to online descrease the size of a filesystem ? I thought :

1. Defragment filesystem : fsadm -E /mountpoint
2. lvreduce ....
3. fsadm -b b /mountpoint

Bruno
13 REPLIES 13
Pete Randall
Outstanding Contributor

Re: Descrease filesystem size

Bruno,

If you shrink the container that holds the file system with lvreduce, you're going to lose data. If you do lvreduce (I can't remember) at all, it would have to be after the fsadm.


Pete

Pete
Bruno Bossier_1
Regular Advisor

Re: Descrease filesystem size

OK, so I was wrong in the sequence :

1. fsadm -E /mountpoint
2. fsadm -b b /mountpoint
3. lvreduce ...

Correct ?
Pete Randall
Outstanding Contributor

Re: Descrease filesystem size

Pete Randall
Outstanding Contributor

Re: Descrease filesystem size

Bruno,

Yes, that's correct:

defrag
fsadm
lvreduce


Pete

Pete
Robert-Jan Goossens
Honored Contributor

Re: Descrease filesystem size

Bruno,

Be on the save side. Create a copy on tape or if you have enough filestore, create a online tar/cpio archive before reducing the volume.

The commands are correct, but the last time I preformed this I got a corrupt filesystem.

Regards,
Robert-Jan
Bruno Bossier_1
Regular Advisor

Re: Descrease filesystem size

I know it's tricky and to be on the safe side, I should backup, delete, recreate and restore. It's for a sapdata filesystem, so even more tricky.

I just wanted to check. I'm not sure whether I would really do it.

Thanks for the answers !

Cheers,
Bruno
Geoff Wild
Honored Contributor

Re: Descrease filesystem size

I agree with Robert Jan - make sure your backups are working.

To be safe - I would reduce during your maintenance window - not during the day.

IE - during a backup - and to be safe - I would have SAP/Oracle down.

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Florian Heigl (new acc)
Honored Contributor

Re: Descrease filesystem size

In general I have good experience with fsadm and reducing filesystems, but I haven't tried it more than 10 times, as it's plain forbidden @work.

You should definitely check the filesystem version and fsadm patch levels before the fsadm call.
root@xxxx:/tmp>fstyp -v /dev/vg00/rlvol15
vxfs
version: 4

if this doesn't print out Version 4 or 5, You might want to think twice on a sapdata filesystem.

florian
yesterday I stood at the edge. Today I'm one step ahead.
Roland Piette
Regular Advisor

Re: Descrease filesystem size

Hello Bruno,

If you decide to apply the procedure, don't do it with SAP running. Your DB will crash when reorganization is running !

Only a remark
Roland
Matthew_50
Valued Contributor

Re: Descrease filesystem size

make a backup of your data before any changes

If you have OnlineJFS. do following steps.
1. fsadm -F vxfs -d -D -e -E /mountpoint
2. fsadm -F vxfs -b 4096000 /mountpoint
3. lvreduce -L 4096 /dev/vg00/lvol12

Note:
-b with new fs size in KB
-L with new fs size in MB
Kevin Wright
Honored Contributor

Re: Descrease filesystem size

If your FS is an even multiple of the extents, it may work. OnlineJFS, although advertised that is can resize, grow and reduce, rarely works correctly on a reduce. As other said, ensure your apps aren't running, and get a solid backup before attempting to reduce.
Bill Hassell
Honored Contributor

Re: Descrease filesystem size

You can safely assume that reducing a filesystem size will DESTROY data on your logical volume. Only if you are running 11.11 *AND* have purchased Online JFS version 3.3 *AND* the filesystem has been created or converted to version 4, will a reduction work. So in the majority of cases, your procedure will always be:

1. save all the files and directories (tape or another disk)

2. Un-mount the lvol

3. lvremove the lvol

4. Re-create the lvol in the size you want

5. newfs the lvol

6. mount the new filesystem

7. Restore your data


Bill Hassell, sysadmin
Fabio Ettore
Honored Contributor

Re: Descrease filesystem size

Hi Bruno,

with the Online JFS product you can shrink the filesystem even if the filesystem is mounted.

Anyway it is the best thing to backup all data before because it always is dangerous to shrink. I remeber something about the filesystem version, you should have the 3.3 or 4 version as Bill and Florian pointed out.

The good order is

fsadm -E /
fsadm -b /M /
lvreduce -L /dev/vgXX/lvolX

Best regards,
Fabio

P.S.: a great feature of this forum is to assign points and it is a good to know if the ITRC people helped you or not (it is an etiquette of this forum). I think people helped you and you consider this forum very useful since you opened many threads. So please remember to assign points because 1/165 is not a great result. Thanks for your contribution and good enjoy!
WISH? IMPROVEMENT!