Skip navigation.
Home

System Slows Down After Drive Upgrade

After upgrading a disk, the system slowed down after a while. The disk would thrash over and over, but the system monitor showed that VM wasn't being used. It seemed OK, because there was enough memory, or so it said.

The problem turned out to be that the swap partition was on the old disk, and had been removed. The solution was to build a new swap and enable it.

Why did this work? Here's a part of the explanation, from Is swap space obsolete?:

File-backed pages can be flushed by writing them back to their file on disk. But anonymous mappings by definition don't have any backing file. Where can they be flushed to? Swap space, of course. Swap partitions or files on Linux hold pages that aren't backed by a file.

If you don't have swap space, then anonymous mappings can't be flushed. They have to stay in memory until they're deleted.

In short, VM lets the kernel keep memory defragmented, making it easier to allocate memory. If you don't have any swap space, the swap daemon isn't started, and VM isn't available. Performance suffers, and oddly enough, one side effect is that the disk thrashes because you can't map the disk to RAM - the system probably can't use the disk-to-memory mapping feature of VM, and has to actually read all the data in.