# Upgrading to 2 CPUs from 1 CPU

## mno

Hi all,

I wanted to ask for advice for the best way to go about upgrading an old server. It's a board that always supported two CPUs (currently has an Opteron 244 running there with 1GB of RAM).  I bought it so long ago when that was expensive, and now want to upgrade to prolong the life of this one longer. It's still great for DB and web serving, etc. 

Anyways, I am going to buy the same CPU as I currently have, and upgrade each CPU's RAM to 2GB (currently has 1GB there).  

I wanted to ask for advice for how to best do that.  The swap is currently set at 2GB, so if we're going to 4x the RAM, I imagine I'd need to resize the swap to 8GB, too.  And, of course, I'd need to re-build the kernel (not an issue).  But are there any other things I should watch out for and keep in mind.  It's running Portage 2.1.8.3 (default/linux/amd64/10.0, gcc-4.4.3, glibc-2.11.2-r0, 2.6.31-gentoo-r6 x86_64).

Thanks in advance,

Max

----------

## Jaglover

Why increase swap when adding RAM?   :Rolling Eyes:  Swap is there for cases when you run out of RAM.

----------

## mno

I understood that it's best practice to have 2x swap of RAM. But if it's not necessary, then I'll not increase it. Resizing partitions is always a pain.

----------

## Jaglover

In past, there was a necessity to increase RAM by adding swap. x4 formula was probably born because there are certain limits how much of RAM contents actually can be swapped. Further increasing of swap size wasn't reasonable. Imagine, 64 MB of RAM, + 256 MB of swap, significant increase. Nowadays RAM is cheap and comes in gigabytes ... my desktop has 2 GB, encoding AVC video and emerging same time and I do not have swap partition. Should I need it I'd create a swap file as temporary relief and buy more RAM.

----------

## mno

Hm good point, thanks.

----------

## digrouz

is it really safe to run without any swap?

----------

## xaviermiller

 *digrouz wrote:*   

> is it really safe to run without any swap?

 

If you run Windows, you will need 2xRAM   :Twisted Evil: 

I don't have SWAP on my machines (1.5 and 2 GO) and everything runs fine. The only reason I would keep swap is for hibernation.

----------

## Naib

if you are that concerned use swapfiles.

There was a time when swapfile performance was significantly less than a swappartition. Quite a few patches ago this was VASTLY improved and now the performance of a swapfile is very close to a partition.

Might be an alternative if you don't want to resize a partition. If you are hitting swap you already have a performance degradation so a couple of % increase in degradation due to a file over a partition is minor

you can use your present swap partition in parallel with a file

```

$ dd if=/dev/zero of=/swapfile1 bs=1024 count=1048576 # 1024 *1024 for a 1gig file

1048576+0 records in

1048576+0 records out

1073741824 bytes (1.1 GB) copied, 17.8743 s, 60.1 MB/s

$ mkswap /swapfile1

Setting up swapspace version 1, size = 1048572 KiB

no label, UUID=69bc7560-f1b0-4734-9e6c-ebe2165b2b6a

$ swapon /swapfile1 

$ vim /etc/fstab

/swapfile1 swap swap defaults 0 0 

$  free -m

             total       used       free     shared    buffers     cached

Mem:          2007       1988         18          0         65       1626

-/+ buffers/cache:        296       1710

Swap:         1533          0       1533
```

and that is with a 512meg SWAP partition

----------

## Mad Merlin

 *digrouz wrote:*   

> is it really safe to run without any swap?

 

Completely safe if you never run out of RAM, which is a reasonable assumption for most modern systems.

Run without swap for awhile and see if you trigger the OOM killer. If you do, get more RAM (or add swap).

----------

## barul

I've only 512MB of swap, 4GB of physical memory, I never exceeded 1GB of use (unless I run a virtual machine in VirtualBox), so I think I can remove swap partition. I'll try it on my next install

----------

## eccerr0r

Really shouldn't be any issue other than plugging the cpu in, compiling kernel for SMP support, most things should just work...

Make sure you configure portage to take advantage of additional CPUs (MAKEOPTS='-j3', etc.)  You probably can "gloss over" swap.  I tend to have enough swap to gracefully notice that the computer's having problems (as in an OOM situation), I'd rather it notify me instead of allowing the OOM killer randomly do its thing...  Having swap will ward off the issue yet still allow slow progress (and time to let me investigate the issue...)

----------

## mno

Thanks eccerr0r!

----------

