Linux swappiness

Recently I had the brilliant idea of adding a second Linux distribution to my computer and install it along with the already existing W7 and Ubuntu installations. The problem was that I had no extended partitions available and none of the MBR slots were free. I had 2 OSs, a large shared data partition and a swap one. I had to do something so I replaced the shared partition with an extended one and inside I made 2 logical partitions. Also I wanted partitions to be more neatly organised so I had also deleted the swap partition to place it near the Ubuntu one. For this to happen I had to make Ubuntu stop using swap memory. During the past week I noticed strange (very slightly) performance drops (even though I have a reasonable 4 GB of memory) and today I realized I forgot to turn the swap back on (I actually thought Linux would just start using the new one and didn’t bother checking).

While installing a virtual machine on Ubuntu, VMPlayer threw out an error just 1 minute before it died, it was a recommendation to add swap space to the machine.

Terminal part

Turning off swap

sudo swapoff

Turning on swap

sudo swapon -a

And here was the problem.

Error: swapon: cannot find the device for UUID=e6e677c9-5da6-49d5-930c-5210c83356fe

I suppose the config file kept the UUID of the old swap partition that I removed, another clue that pointed to this problem was given by Ubuntu itself. At boot time, while loading the system it used to halt for a few seconds during the purple startup screen and say something like UUID e6e677c9-5da6-49d5-930c-5210c83356fe could not be found – abort mounting or mount manually. I had seen computers before showing such behaviour (at university) but had never knew what was wrong. The config file responsible is /etc/fstab. here I found the UUID for the swap partition and replaced it with the right one.

To find the UUID of the current partitions:

sudo blkid -o list (man page)

sudo vim /etc/fstab

Effect: (viewed with blkid)

/dev/sda6 swap (not mounted) a87bc3d5-d477-460f-8017-131f84fcdfd8

/dev/sda6  swap             <swap>         a87bc3d5-d477-460f-8017-131f84fcdfd8


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s