Swap Parition Size

Hello.

Today, I installed 12.2 XFCE, after being away from openSUSE for a while. When I installed, it gave me a 2Gb swap partition. I have 4.7gb of RAM installed & “seen” by the system. I’ve always thought swap partition size should at least be equal to the amount of RAM(in miy case, I’d round up to 5). If this is true, is it possible to increase my swap partition?

I asked this question from time to time. Substantially you can wrap it up as follows: for the main part of usages a 2 GB swap partition will largely suffice, even if using suspend to ram. But there are cases, e.g. if using “monolitical architecture software” that requires to use a certain amount of ram, or photo manipulation, where the limit might be exceeded, causing data-loss if your system goes down to suspend on HDD. In this cases, the only way to have total security is to attribute a swap corresponding in size to your total Ram available, that is 4.7GB in your case. You can change the partition (after backup) the most easily if you use a life CD from Parted Magic. You cannot change the size of the SWAP without reinstalling AFAIK, if you used during the install the option of LVM encrypted partitions. What you can do in any case is when installing to choose the option “expert settings” (or similar) and to define the size of the swap partition yourself. As the installer program will have attributed all available space, you will have to reduce/resize the settings for the other partitions accordingly to free up the necessary space, prior to change the swap size.
You may to refer to this link to find all necessary information:
https://doc.opensuse.org/documentation/html/openSUSE/opensuse-reference/cha.advdisk.html
Hope that helps

Of course you can. you will need first to resize 1 of the adjacent partitions to generate the extra 2.7 GB needed as unallocated space. Then resize your swap partition for that extra space. Piece of cake.
You cannot do it while booted in Linux. If you have a dual boot system with Windows, you can use Partition Wizard for that. If not, you can boot in Rescue mode from the Linux DVD and use a Linux App for the same.:wink:

Resizing SWAP to add more SWAP space can be messy except you can just shrink something and add a separate additional SWAP space if you like though not every operation can take advantage of having two SWAP’s at the same time. I must add that unless you are running out of SWAP space under certain operations, no further action is required at this time. Opening up terminal and typing in the terminal command free and if used SWAP space remains at 0, you have no problems. I have an article about the SWAP space, though it does not address having two or more separate SWAP spaces to use.

Setting up the Proper Size SWAP File in openSUSE: https://forums.opensuse.org/blogs/jdmcdaniel3/setting-up-proper-size-swap-file-opensuse-114/

Thank You,

On 2013-03-09 00:46, RobNJ wrote:
>
> Hello.
>
> Today, I installed 12.2 XFCE, after being away from openSUSE for a
> while. When I installed, it gave me a 2Gb swap partition. I have 4.7gb
> of RAM installed & “seen” by the system. I’ve always thought swap
> partition size should at least be equal to the amount of RAM(in miy
> case, I’d round up to 5). If this is true, is it possible to increase my
> swap partition?

There is no fixed rule for the swap space size. The real rule is “as big
as you need”.

So… are you going to hibernate? Then it should be bigger than your RAM.

Are you going to use very hungry software? Then even bigger (or better
more RAM).

You are not going to use hibernation, but very hungry software? In this
case you can, instead of enlarging the current swap partition, add more
swap partitions or add swap files.

You are never going to hibernate, and your software needs are “normal”?
Then leave it as it is.


Cheers / Saludos,

Carlos E. R.
(from 11.4, with Evergreen, x86_64 “Celadon” (Minas Tirith))

On 2013-03-09 02:56, jdmcdaniel3 wrote:
> though it does not address having two or more
> separate SWAP spaces to use.

Having several swap partitions, placed on different disks, and at the
same priority, has the huge advantage of parallelizing i/o operations:
faster system when swap is needed. The advantage is lost when done on
the same disk, but it works, nevertheless.

There is an issue, though: that hibernating and restoring a system can
not be done, to my knowledge, on several swap partitions. You may have
several, but only one is used for hibernation (on older kernels you got
an error on this situation).


Cheers / Saludos,

Carlos E. R.
(from 11.4, with Evergreen, x86_64 “Celadon” (Minas Tirith))

Thanks for the replies, everyone… I’ll let it go for now, to see if I do run out of swap. If so, I’ll give this a try.

The “equal to RAM” advice is a Windows thing, to hold memory crashdumps.

If you’re running 32bit without special extensions, there is no advantage to having any swap, it’s unaddressable. If you’re running with extensions, then the swap might be useful.

If you’re running 64bit, then the swap is totally accessible and you can make it as small or large as you want (highly unlikely you’ll bump into any limits on any hardware for at least the next couple decades)

TSU

On 2013-03-10 15:56, tsu2 wrote:
> The “equal to RAM” advice is a Windows thing, to hold memory
> crashdumps.

No, the Windows practice is twice the RAM. It is an old practice from
the Windows 3 times, because then you could not have more even if you
wanted.

Nowdays Windows people do not even know if they have swap, it is an
automatic setting. The system adjusts it dynamically (in a file).


Cheers / Saludos,

Carlos E. R.
(from 11.4, with Evergreen, x86_64 “Celadon” (Minas Tirith))

I suggest you should allow openSUSE to at least create its suggested SWAP sized partitions and never opt to have no SWAP file. While making the SWAP file too big does waste disk space, not having any can put you at risk of a lock up depending on how much memory you have and just what tasks you are trying to perform. If you know better then you are above the discussion level of this message thread. With the size of hard disks these days, what is the problem in allowing 2 or 4 GB for a SWAP partition? Until such time as the openSUSE installer does not by default create a SWAP partition, continue to use at least the default sized SWAP the openSUSE installer suggests to you. This message is intended for the typical openSUSE user on the SWAP partition size.

Thank You,

On 03/10/2013 09:56 AM, tsu2 wrote:
>
> The “equal to RAM” advice is a Windows thing, to hold memory
> crashdumps.
>
> If you’re running 32bit without special extensions, there is no
> advantage to having any swap, it’s unaddressable. If you’re running with
> extensions, then the swap might be useful.
>
> If you’re running 64bit, then the swap is totally accessible and you
> can make it as small or large as you want (highly unlikely you’ll bump
> into any limits on any hardware for at least the next couple decades)

With Linux, the swap file is used to hold memory contents when hibernating. If
you want that feature for your system, then you need to have a swap at least as
big as the compressed size of a memory dump. With normal compression, that will
be 1/2 the size of RAM.

In addition, having a swap file is always advised for the rare occasions when
you run a program mix that just happens to exceed memory contents. Without swap,
the out-of-memory recovery process will just kill some process so that the
system can continue. I once had a swap file get corrupted so that it could not
be mounted. The first I noticed it was when Firefox suddenly started “crashing”.