How to resize the swap

At first my swap was set to 1GB and my memory is 8GB.
Right now I need to increase the size of swap to improve the performance because it’s for a enterprise use.
Is there anyway to resize the swap, I mean except to reinstall the OS?
Thanks for any reply…

You could try gparted but make sue you backup first

Geoff

I’m sure liGNUx is flexible enough you could make it use several swap partitions in parallel, perhaps even located on different drives; anyhow, if that can’t be done, you sure can add swap files to your current configuration (yes, liGNUx can use swapfiles too). Or, you could just find a space for this new partition anywhere (trivially, by resizing another partition; or, less trivially: by using any unused/expendable/obsolete/relocatable partition as swap; by formatting your swap partition with a useful filesystem to accomodate the data from a bigger, but sparsely used partition, which then can become your swap; by adding a SSD to your system; by adding another hard drive; by finding some unused space on a pre-existing drive and partitioning it; and so on …), format it with the swap filesystem and mount it as swap in your fstab. You’re in no way limited only to resizing the current swap partition; any available partition may become your swap in two minutes time. On a running system, without having to reboot and without any downtime.:slight_smile:

With 8Gb ram, i doubt you are even touching swap, unless you have several memory-intensive programs running,e.g. video editing & 3D rendering spring to mind. So, just leave swap as is for now, & if you see it being used,it means it’s time to add more ram. Just an FYI, increasing swap ( if it is used ) will only degrade performance,as,hard drive ram ( swap ) is slower than physical ram

Andy

… and to see if it is used:

swapon -s

as root.

To increase swap it is not needed to increase the swap partition you have now. You can have more swap partitions and the system is happy to use them together. So when you want to try, just a partition of a few GB. Go to YaST and add it as Swap. You can turn it on and off from the command line with swapon and swapoff (see their man pages).

Yes.

There is no need to change extend/change the size of your current swap partition.
If you are concerned about the most effective way of using swap space in an enterprise production environment,
do as suggested by someone above: add new swap space.

If you manage to locate those new swap partitions in different disks, you can take advantage of the kernel being able to use them in parallel.

Create them as always: fdisk, mkswap, swapon.
Then, modify your /etc/fstab so that it looks like this:

....
....
/dev/sdb1 	swap 	swap 	pri=1 	0 0
/dev/sdc1 	swap 	swap 	pri=1 	0 0
/dev/sdd1 	swap 	swap 	pri=1 	0 0
....
....

pri=1 is telling the kernel to consider them all having the same priority, so that they can be accessed in parallel.
For better results, keep in mind that the best place for the swap partitions to be located in is at the beginning of the disk, preferrably connected to different controllers.

It is also strongly suggested to use disk drives with the same access time features. This would make the access times predictable and uniform.

Hope this helps.

Regards.

OTOH, you need a swap at least as large as your RAM if (and only if) you want to suspend to disk.