Operating System - HP-UX
1833847 Members
2369 Online
110063 Solutions
New Discussion

Easy question file system question

 
Gene Laoyan
Super Advisor

Easy question file system question

I have have a logical volume called "FileBack" and it is allocated 75GB of space. I need to reuce it to 36GB of space so I can create an additional swap file. How do I do this?

Thanks
5 REPLIES 5
James R. Ferguson
Acclaimed Contributor

Re: Easy question file system question

Hi Gene:

If you have OnlineJFS and this is a VxFS (JRF) filesystem, you could use 'fsadm' to shrink the *filesystem* and then use 'lvreduce' to shrink the *logical volume*.

Otherwise, backup any data you want to keep; 'lvremove' or 'lvreduce' the logical volume; 'newfs' the filesystem (now smaller) and reload your data from backup.

If you choose the first option (to shrink the filesystem with 'fsadm') you should backup your data before beginning anyway.

Regards!

...JRF...
Paul F. Bennett
Advisor

Re: Easy question file system question

That's a little tricky, assuming there is data on the filesystem you risk corrupting the data. There has to be less than 39GB of data on the filesystem and even thne I 'think' you may risk corrupting the data if it is fragmented. In addtion, unless you have OnlineJFS the filesystem must me umounted. In my opinion you should back up the data, recreate the filesystem(s), restore the data and then create the swap.

PFB
Gene Laoyan
Super Advisor

Re: Easy question file system question

OK, I unmounted the logical volume and did an lvreduce. Yes it did corrupt the data in that logical volume and it now says I need to run a check on that logical volume. The data was just copies of .iso files so there was no big deal there. Now how do I "Check" or uncorrupt the logical volume?

Thanks
TwoProc
Honored Contributor

Re: Easy question file system question

Run "fsck" , or better yet, if it's files you've got backed up. Run "newfs" and put a new file system there, then restore the files.
We are the people our parents warned us about --Jimmy Buffett
A. Clay Stephenson
Acclaimed Contributor

Re: Easy question file system question

If you are running an OnlineJFS version prior to 3.3, Stop! Do not pass Go. Do not collect $200.00. I can all but guarantee you that an fsadm -F vxfs -b smaller_size is going to corrupt your data. While the filesystem enlargement has never been a problem (well in the last 10 years or so), the shrinkage was fraught with peril although at version 3.3 and up, I've never had a problem --- and I've tried hard to break it.

As the others have said, Plan B would be to backup, create a smaller LVOL, and restore. That will certainly work.

How about a Plan C? Keep the filesystem as it is and add that dreaded, awful filesystem swap. That will accomplish your goal and it's not nearly so bad as you might think --- especially if your assign the filesystem swap very low priority (e.g. 7 or so). It will then be used as a weapon of last resort. In reality, filesystem swap isn't so bad. If you are swapping to any significant degree, you are already taking a 100x or so performance hit. Now, let's assume that filesystem swap is twice as bad; you're now taking a 200x performance hit. Big Woo! They're both terrible and I doubt one will make you any less frustrated than the other --- and, if you are adding the swap as some sort of installation requirement but otherwise won't be using it then filesystem swap is perfect and easy.
If it ain't broke, I can fix that.