LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-10-2013, 02:02 PM   #1
Senthilv
Member
 
Registered: Jan 2011
Posts: 66
Blog Entries: 2

Rep: Reputation: 0
Extend the Swap Memory ?


Hai All,

Assume that i have installed centos and its running as fine, when i installing os its having ram memory of 2GB, but while installing time i have given as ram size is wrongly as 1024(i.e swap memory is 1024)

Now i just want to update the ram size as 2GB, i.e. i want to extend the swap memory as 2048, this will happen without down the os or without delete the swap memory and again for recreating swap memory like that ...

Just i want to extend the swap memory as 2048 ...

Is it possible this ?
 
Old 06-10-2013, 02:07 PM   #2
shane25119
Member
 
Registered: Aug 2003
Location: Illinois
Distribution: Linux Mint XFCE
Posts: 654

Rep: Reputation: 53
Sure, use GParted to resize the partition.
 
Old 06-10-2013, 02:15 PM   #3
Senthilv
Member
 
Registered: Jan 2011
Posts: 66

Original Poster
Blog Entries: 2

Rep: Reputation: 0
Mr shane,

You said GParted, using this we have to shut down the system, i asked without shutdown the computer.
 
Old 06-10-2013, 02:17 PM   #4
shane25119
Member
 
Registered: Aug 2003
Location: Illinois
Distribution: Linux Mint XFCE
Posts: 654

Rep: Reputation: 53
No, since the partition cannot be in use if you're resizing it. Running GParted off a live cd gets around that.

The whole process should take less than 10 minutes.
 
Old 06-10-2013, 02:29 PM   #5
Senthilv
Member
 
Registered: Jan 2011
Posts: 66

Original Poster
Blog Entries: 2

Rep: Reputation: 0
No, this swap memory currently running, within this itself i want to extent the swap memory.
 
Old 06-10-2013, 02:41 PM   #6
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,138

Rep: Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263
Safest is to create a new 1GB swap space and add that to fstab. Then do swapon -a
 
Old 06-10-2013, 02:41 PM   #7
shane25119
Member
 
Registered: Aug 2003
Location: Illinois
Distribution: Linux Mint XFCE
Posts: 654

Rep: Reputation: 53
If your system is currently running the swap memory partition is in use. It cannot be extended without powering down the system.

Is there a reason you do not want to boot into a live cd?
 
Old 06-10-2013, 02:42 PM   #8
shane25119
Member
 
Registered: Aug 2003
Location: Illinois
Distribution: Linux Mint XFCE
Posts: 654

Rep: Reputation: 53
@Smallpond, that assumes there is unpartitioned space and it also creates the problem of unused space that is the old swapspace.
 
Old 06-10-2013, 02:44 PM   #9
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
1) You probably don't need to increase swap. There is no meaning behind whatever rule you found relating ram size to swap size. Increasing swap to 2GB is probably a good idea at some point, but not urgent enough to worry about now.

2) If you really need more swap space right away with minimum disruption on a running system, add a swap file (1GB). Linux can use multiple independent swap allocations (as the total of their sizes). Swap files are a lot easier to add on the fly than adding or resizing partitions.
 
Old 06-10-2013, 03:25 PM   #10
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,138

Rep: Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263
Quote:
Originally Posted by shane25119 View Post
@Smallpond, that assumes there is unpartitioned space and it also creates the problem of unused space that is the old swapspace.
What problem? Use both.
 
Old 06-10-2013, 03:39 PM   #11
shane25119
Member
 
Registered: Aug 2003
Location: Illinois
Distribution: Linux Mint XFCE
Posts: 654

Rep: Reputation: 53
^ True, that would work- but your partition table gets real ugly real fast that way (not that it matters terribly much, I just like an orderly partition table).
 
Old 06-10-2013, 08:57 PM   #12
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,355

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
1. forget talking about RAM: you've got what you've got and the system doesn't let you set that on install anyway. It'll use it all.
See the output from 'top'.

2. as above, what you're talking about is swap space on disk.
Its perfectly possible to add and and activate another swap partition without re-booting IF you already have some spare disk space to put it (NB: I don't think you can resize root '/' partition when its running; its risky in any case).
What you need to do is google for your Linux distro and 'add swap' to see how.
Note that a swap partition is different from a swap file, although they perform the same job. I'd go with adding a partition.
 
Old 06-10-2013, 11:45 PM   #13
EDDY1
LQ Addict
 
Registered: Mar 2010
Location: Oakland,Ca
Distribution: wins7, Debian wheezy
Posts: 6,841

Rep: Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649
Quote:
Its perfectly possible to add and and activate another swap partition without re-booting IF you already have some spare disk space to put it (NB: I don't think you can resize root '/' partition when its running; its risky in any case).
It's possible to add swap partition(not sure about extending) on running system only if there is free space, if no free space then they will have to free up space from another partition & extend swap. The problem is which partition to free up space & how many partitions have to be moved to access it. Also can the partitions be unmounted to perform task. Most likely OP needs to shutdown to perform task.

Quote:
Assume that i have installed centos and its running as fine, when i installing os its having ram memory of 2GB, but while installing time i have given as ram size is wrongly as 1024(i.e swap memory is 1024)
I've never had a system ask about ram size nor swap.

Last edited by EDDY1; 06-10-2013 at 11:49 PM.
 
Old 06-11-2013, 04:34 AM   #14
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,355

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
If you do custom partitions during install, you specify swap space.
RAM: no, I think that's a confusion about 'virtual mem' implications.
 
Old 06-11-2013, 07:37 AM   #15
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
Quote:
Originally Posted by chrism01 View Post
Note that a swap partition is different from a swap file, although they perform the same job. I'd go with adding a partition.
There is barely any advantage to a swap partition vs. a swap file. In normal operation, there is no advantage to partition vs. file.

If expanding the existing swap partition were easy, I would recommend it. If we saw output from
/sbin/fdisk -l
we would have a better idea whether expanding or adding a swap partition without booting alternate media is easy, difficult, or impossible.

Meanwhile, I'm assuming that is not easy, so adding a swap file is easy and solves the problem.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Live DVD runs out of memory - using swap - free memory doesn't help at upgrade .... LiNuXkOlOnIe Linux - Distributions 3 06-09-2013 09:35 PM
[SOLVED] How to extend SWAP memory yashfire007 Linux - Newbie 9 02-14-2013 06:42 AM
memory metric to monitor memory usage or swap? karlochacon Linux - Newbie 5 08-13-2011 03:49 PM
Swap Memory / Virtual Memory in Fedora Core 6 Jojo_CFT Linux - Newbie 2 10-15-2007 04:23 AM
Difference between Swap Virtrual memory and Swap Parition Nappa Slackware 4 11-27-2003 07:58 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:09 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