LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-15-2002, 12:40 PM   #1
strider
LQ Newbie
 
Registered: Apr 2002
Location: Everett, WA
Distribution: RedHat 7.2
Posts: 10

Rep: Reputation: 0
Question Changing Swap space


I just got done upgrading one of our servers to Redhat 7.2 When I was adding the swap space I mistakenly created it as 8MB! Oops. Now some of my customers are getting forking errors when my swap space is full. My question is how can I change the swap size on that partition. Can I do it without interupting access? I have no free space left, so can I reduce the size of one of the other partitions and allocate it over to swap? Thanks for your help on this.
 
Old 04-15-2002, 12:49 PM   #2
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
you can always create swap space with the mkswap command.

man mkswap
 
Old 04-15-2002, 01:11 PM   #3
strider
LQ Newbie
 
Registered: Apr 2002
Location: Everett, WA
Distribution: RedHat 7.2
Posts: 10

Original Poster
Rep: Reputation: 0
Question

Is it possible to delete my current swap partition, change the sizes of others and recreate a bigger swap partition, or am I asking for too much? The mkswap command seems to use space on an existing partition. What does this do to the use of that partition?
 
Old 04-15-2002, 02:09 PM   #4
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
yeah you can make a swap parition with the mkswap command then add it to your fstab file so it mounts it at bootup, but you first have to have the parition setup that you would want to use.. that usually requires third party software if you want to move or change a current partition setup.
 
Old 04-15-2002, 02:15 PM   #5
jatimon
Member
 
Registered: Apr 2002
Posts: 33

Rep: Reputation: 15
hmm

let me see if I understand this.

Your system is busy enough that swap is being maxed out. You have now free space in your HD. You want to increase the amount of swap available.

this is tricky

if your swap is being consumed, you don't want to shut down the one and only swap partition. If you had free disk space you could create another swap file and that would help alleviate your problem.

I beleive you can even create a swap file on an NFS mount, but dont quote me on this.

You cannot shut off your swap if it is the only one present and it is maxed out.

as for resizing partitions while the system is live. You would likely get away with swap, but not anything mounted. If you touch a mounted filesystem, you could inadvertently truncate and be really hosed.

Here is what I would do. Get another HD, and find a time to put it in the box. Slice up the drive so that you can have some extra partitions for more swap in the future as well as regular filesystem space. Once the box is back up you can create and add and extra swap partition or two. Make it permanent by editing /etc/fstab and adding it in.

More memory would be good too.

unfortunately, native Linux does not handle dynamic resizing of filesystems. there are logical volume management software solutions that do do this though. However none that I have used (Veritas, SDS, AIX's LVM) would I ever try to shrink a volume.
 
Old 04-15-2002, 02:52 PM   #6
strider
LQ Newbie
 
Registered: Apr 2002
Location: Everett, WA
Distribution: RedHat 7.2
Posts: 10

Original Poster
Rep: Reputation: 0
Post

I'm pretty sure I don't need more physical memory, but it is a good suggestion. I currently have 1GB of RAM and I think the main problem is that my swap is so much smaller (8MB). We normally go for 2xRAM for swap size, but I totally goofed when setting up the fs's during install. Obviously now that I've gotten all of my users and everything set-up I'm not too keen on re-installing an OS.
I guess my final question would be, how do I display the amount of non-partitioned free space available? I thought perhaps a df would show it, but I don't see it. Thanks alot, trickykid and jatimon for your help guys.
 
Old 04-15-2002, 02:56 PM   #7
strider
LQ Newbie
 
Registered: Apr 2002
Location: Everett, WA
Distribution: RedHat 7.2
Posts: 10

Original Poster
Rep: Reputation: 0
Thumbs up

Also the adding a hard drive idea is good as well. Since I don't want to mess with the mounted filesystems. But I may have some unallocated free space, I just need to figure out how to see what there is available.
 
Old 04-15-2002, 05:26 PM   #8
DMR
Member
 
Registered: Jun 2001
Location: Fairfax, California
Distribution: RH 9.0, RH 7.3, Mandrake 8.0
Posts: 986

Rep: Reputation: 30
Fdisk will display your patition info. There's also a hardware browser in Redhat which will give you the info. It's buried in one of the configuration/system info menus under the "start"" button; I think you can also just open a term and type "hwbrowser" to launch it.
 
Old 04-15-2002, 07:45 PM   #9
kibble
LQ Newbie
 
Registered: Apr 2002
Posts: 14

Rep: Reputation: 1
I to would suggest another hd. However since you weren't quite clear on having free space on the currect hd[s] a fix that I can suggest if indeed to have space to spare is a swap file. mkswap will work equally well on a file, and the kernel doesn't care about partition or file either way. Simply make an empty file. dd if=/dev/zero of=swapfile bs=1024k count=500. Now obviously place this somewhere logical like a partition you have space to spare, and change 500 to suit your mb size, it's currently 500, then just mkswap swapfile and swapon swapfile, add it to /etc/fstab and you're off to the races. There won't be any speed problems from this and if/when you do get a new hd or repartition or what have just delete that swapfile and you've lost nothing.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to reduce swap space and reclaim the space grantm Linux - Newbie 7 08-16-2012 07:05 AM
Changing SWAP space seesharp Fedora 4 12-23-2004 04:17 PM
Too much SWAP space? Mufasa Linux - General 1 11-20-2004 09:50 AM
How to unmount actual swap and mount a new(bigger) swap space? isaac Linux - Newbie 1 06-06-2004 01:23 AM
Swap Space blkbird Linux - Software 4 02-06-2004 03:14 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration