Operating System - HP-UX
1833777 Members
2543 Online
110063 Solutions
New Discussion

Replacing swap with larger logcial volume - Can I remove fstab entry

 
SOLVED
Go to solution
Jack C. Mahaffey
Super Advisor

Replacing swap with larger logcial volume - Can I remove fstab entry

I want to replace a 1gb swap logical volume with a 2gb logical volume.

Question:
Can I comment out the entry in /etc/fstab, reboot, delete and recreate the logical volume with a bigger size and then re-enable swap to use the larger logical volume?


Will the server have any problems shutting down if the fstab entry is missing?
12 REPLIES 12
Mark Grant
Honored Contributor
Solution

Re: Replacing swap with larger logcial volume - Can I remove fstab entry

You can not remove swap on a running system and in any case, swap must be contiguous and probably needs to be the second logical volume in the volume group. So, this probably won't work for you. It is possible to extend existing swap but can be a real pain.

All sounds rather depressing! However, there is nothing to stop you having two swap logical volumes. Keep your existing one and just create a new 1GB logical volume and add it to /etc/fstab taking the existing entry as a template. You can start using this new swap immediately with the "swapon" command.
Never preceed any demonstration with anything more predictive than "watch this"
Jeff Schussele
Honored Contributor

Re: Replacing swap with larger logcial volume - Can I remove fstab entry

Hi Jack,

I assume you mean secondary swap - not in vg00.
In that case - certainly - you can do that. I would just caution you to keep the system quiesced such that you won't need that secondary swap for reservation purposes.
Also I'd urge you to verify you kernal parms maxswapchunks & swchunks to make sure they're high enough before adding or raise them on the first boot so they will be.

Rgds,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
A. Clay Stephenson
Acclaimed Contributor

Re: Replacing swap with larger logcial volume - Can I remove fstab entry

That depends. I assume that by "swap" you are referring to primary swap. You must have some and it must be on the boot disk and it must be a contigious LVOL. Leave it alone and simply create an additional 1GB swap area for you total 2GB swapspace. The only gotcha (although its really no big deal) is that swap areas on the same physical disk should not have equal priorities.

If this is secondary swap then simply change the /etc/fstab entry to reflect the new swap LVOL and reboot. The system won't care and the reboot will utilize the new swap LVOL. You can then remove the original, non-primary swap LVOL.
If it ain't broke, I can fix that.
Jack C. Mahaffey
Super Advisor

Re: Replacing swap with larger logcial volume - Can I remove fstab entry

I planned on making the new swap continous. I just realized that I actually had two logical volumes for secondary swap that I want to combine into a single logical volume. This is what I was thinking of doing.

1 - Comment out secondary swap entries (not lvol2) from /etc/fstab
2 - Reboot the server. Swapping on the logical volumes should not be in use at this point. The default lvol2 will be used.
3 - lvremove the two old swap volumes.
4 - lvcreate -C y -L 2000 -n lvol3 /dev/vg00
5 - Re-insert one more swap entry in /etc/fstab.
6 - Reboot.

Not sure if I was clear before.
Jeff Schussele
Honored Contributor

Re: Replacing swap with larger logcial volume - Can I remove fstab entry

Hi Jack,

I don't believe you need that last reboot.
You can activate *new* swap with just

swapon -a

IF you have it's entry proper in the fstab file AND you have the sufficient sized kernel parms already set.

My 2 cents,
Jeff (Who's all for minimum reboots)
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Jack C. Mahaffey
Super Advisor

Re: Replacing swap with larger logcial volume - Can I remove fstab entry

I was pretty sure the reboot wasn't necessary. I just wanted the warm fuzzy while I still have the server.
Sanjay_6
Honored Contributor

Re: Replacing swap with larger logcial volume - Can I remove fstab entry

Hi,

Do not mess with lvol2 (primary swap / dump). If you want to increase the size of primary swap, take a ignite backup and rebuild the root disk using the ignite tape.

Hope this helps.

Regds
Jack C. Mahaffey
Super Advisor

Re: Replacing swap with larger logcial volume - Can I remove fstab entry

I was going to leave lvol2 alone. I actually have a lvol2, lvol3 and a lvswap3 on the same disk. I only want a lvol2 and lvol3.

Jack
Sanjay_6
Honored Contributor

Re: Replacing swap with larger logcial volume - Can I remove fstab entry

Hi Jack,

If you are worried about multiple swaps and want to combine them into one single swap, don't do that.

//Quote//
Multiple swap areas on different disks perform better than one swap area of the equivalent size
//endQuote//

Try this link below,

http://www1.itrc.hp.com/service/cki/docDisplay.do?docLocale=en_US&docId=200000072951343

The ITRC doc id is KBAN00000895.

Hope this helps.

Regds
Jeff Schussele
Honored Contributor

Re: Replacing swap with larger logcial volume - Can I remove fstab entry

Hi Sanjay,

Well, technically yes.
But IF you're swapping it won't make much difference as performance will be in the toilet anyway. And when it comes to swap reservation, since nothing is actually written to the device, it won't make any difference there as well.

My 2 cents,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Jack C. Mahaffey
Super Advisor

Re: Replacing swap with larger logcial volume - Can I remove fstab entry

I dont' have the option of additional disks. I'm stuck with the two in the N4000 cabinet. All other disks are shared on a disk array that only has one server connected at one time. I agree with your input, but my hands are tied.

I added the lvswap3 in an emergency because swap was originally undersized. I'd like to have only lvol2 and lvol3, nothing more.

jack..
Sanjay_6
Honored Contributor

Re: Replacing swap with larger logcial volume - Can I remove fstab entry

Hi Jack,

If you want only lvol2 on the system, then ignite is the way to go.

Jeff,

I'm not sure that i agree with you. But of-course the ground realities might be different for both of us.

Hope this helps.

Regds