Is it possible to change the swap size with out re-installing the system?
Looking at the dd command but don't really know what to expect.
Many thanks for your help
On 3/29/07, Stewart Walker Swalker@caspercollege.edu wrote:
Is it possible to change the swap size with out re-installing the system?
Looking at the dd command but don't really know what to expect.
Many thanks for your help
-- This message has been scanned for viruses and dangerous content by MailScanner at caspercollege.edu and is believed to be clean.
CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
dd if=/dev/null of=/younewswap bs=1024 count=1024000 <-- for 100MB mkswap /yournewswap swapon /yournewswap
add an entry to your /etc/fstab and youre done .
Stewart Walker spake the following on 3/28/2007 2:29 PM:
Is it possible to change the swap size with out re-installing the system?
Looking at the dd command but don't really know what to expect.
Many thanks for your help
If you have the space available, you can add, remove, or change the swap on demand. If you have unpartitioned space you could add a partition as large as you want, with type 82 (linux swap), use mkswap to format it, and swapon the partition. Then you could swapoff the old one and use the space for something else. Then adjust /etc/fstab to reflect the new info. You might be able to resize a swap partition from a rescue disk with parted.
Scott Silva wrote:
Stewart Walker spake the following on 3/28/2007 2:29 PM:
Is it possible to change the swap size with out re-installing the system?
Looking at the dd command but don't really know what to expect.
Many thanks for your help
If you have the space available, you can add, remove, or change the swap on demand. If you have unpartitioned space you could add a partition as large as you want, with type 82 (linux swap), use mkswap to format it, and swapon the partition. Then you could swapoff the old one and use the space for something else. Then adjust /etc/fstab to reflect the new info. You might be able to resize a swap partition from a rescue disk with parted.
I don't know what advantage swap partitions have over swap files.
Swap files can be created and added as any time.
John Summerfield wrote:
I don't know what advantage swap partitions have over swap files.
Swap files can be created and added as any time.
they are always contiguous, and have no overhead in inode and cluster mapping.
that said, the actual swap usage on a non-overloaded system -should- be close to zero.
John R Pierce wrote:
John Summerfield wrote:
I don't know what advantage swap partitions have over swap files.
Swap files can be created and added as any time.
they are always contiguous, and have no overhead in inode and cluster mapping.
Contiguous is irrelevant; unless one has disk dedicated to swap, the partition's never close to anything important.
Is the rest something that matters for 2.6 kernels?
See http://en.wikipedia.org/wiki/Virtual_memory [edit] Swapping in the Linux and BSD operating systems
that said, the actual swap usage on a non-overloaded system -should- be close to zero.
Indeed. And if it's high, a good way to reduce it is to add RAM. It escapes me though, why I should add swap too.
that said, the actual swap usage on a non-overloaded system -should- be close to zero.
Indeed. And if it's high, a good way to reduce it is to add RAM. It escapes me though, why I should add swap too.
To prevent random OOM Killer Action in the case something goes wrong :D
kernel rolls dice
sshd
kernel nukes sshd
Feizhou wrote:
that said, the actual swap usage on a non-overloaded system -should- be close to zero.
Indeed. And if it's high, a good way to reduce it is to add RAM. It escapes me though, why I should add swap too.
To prevent random OOM Killer Action in the case something goes wrong :D
That's never worked in the past.
Cheers John
-- spambait 1aaaaaaa@coco.merseine.nu Z1aaaaaaa@coco.merseine.nu
Please do not reply off-list
To prevent random OOM Killer Action in the case something goes wrong :D
That's never worked in the past.
Well...for a fast memory chewing bug I guess not...
But people who have stuff in place to monitor memory and swap usage will have a chance to catch things for those that slowly chew up memory.
Feizhou wrote:
To prevent random OOM Killer Action in the case something goes wrong :D
That's never worked in the past.
Well...for a fast memory chewing bug I guess not...
But people who have stuff in place to monitor memory and swap usage will have a chance to catch things for those that slowly chew up memory.
Mozilla chews memory slowly. The system either gets slower until it's too painful, or it gets slower until oom goes mad.
It was pretty bad on RHL 7.3 which I used to run in 128 mbytes, and on occasion I found Moz "using" 700 Mbytes plus.
It still seems to happen, but I generally kill if for some other reason (eg it tends to loop and take all CPU).
Now, if I knew how to make postgresql take a little more. It's been running, loading a table, for almost two days on my laptop. Over 1 Gbyte RAM, pg's only using 11m res, about 20mbytes all up.
John Summerfield spake the following on 3/28/2007 5:49 PM:
Scott Silva wrote:
Stewart Walker spake the following on 3/28/2007 2:29 PM:
Is it possible to change the swap size with out re-installing the system?
Looking at the dd command but don't really know what to expect.
Many thanks for your help
If you have the space available, you can add, remove, or change the swap on demand. If you have unpartitioned space you could add a partition as large as you want, with type 82 (linux swap), use mkswap to format it, and swapon the partition. Then you could swapoff the old one and use the space for something else. Then adjust /etc/fstab to reflect the new info. You might be able to resize a swap partition from a rescue disk with parted.
I don't know what advantage swap partitions have over swap files.
Swap files can be created and added as any time.
Just another option as someone else posted swap file specific commands.
Depends on what you mean by changing the swap size. You can increase swap size by adding a swap file, which is a regular file on a "regular" filesystem. This can be done in a matter of minutes with only a few commands. I haven't done it in a couple years, so I can't give you the details off the top of my head.
If you want to increase the size of a swap partition, or create another swap parition, there's more work involved. Depending on how your disk(s) are partitioned, it's possible to do it w/o rebuilding the entire system. If you have to destroy a partition to give up some of it's space to a new swap partition, you can tar the contents of that partition up, repartition the disk, and then untar the files on to the new partition. You shouldn't need to re-install the entire system.