# swapoff - slow

**URL:** https://forums.suse.com/t/swapoff-slow/35396
**Category:** SLES Configure-Administer
**Created:** [November 26, 2020, 12:52pm UTC](https://forums.suse.com/t/swapoff-slow/35396 "2020-11-26T12:52:25Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![willem.lourens](https://avatars.discourse-cdn.com/v4/letter/w/35a633/32.png) [@willem.lourens](https://forums.suse.com/u/willem.lourens)
#### Post date: [November 26, 2020, 12:52pm UTC](https://forums.suse.com/t/swapoff-slow/35396/1 "2020-11-26T12:52:25Z")

</div>

Hi  
I need to reduce the swap assigned to a server from 244 GB to 2 GB, on a SLES 12.4 server.

When the database on this server is online, the swap is use, and cannot be unmounted. I stopped the database, and started the swapoff in yast. After 4 hours the swapoff was still busy executing.

On OS level I could see the swap reducing at a very slow pace using “free -m”. After 4 hours the swapoff process was still very busy, and 90 GB swap was still assigned - counting down at a very slow pace. But the downtime window was over and I had to kill the swapoff process. This undid the operation, swap assigned is back at 244 GB.

Is there another method to execute the swapoff faster?

Thanks,

---

<div class="post-metadata">

### Author: ![malcolmlewis](https://sea2.discourse-cdn.com/flex022/user_avatar/forums.suse.com/malcolmlewis/32/11375_2.png) [@malcolmlewis](https://forums.suse.com/u/malcolmlewis)
#### Post date: [November 26, 2020, 1:40pm UTC](https://forums.suse.com/t/swapoff-slow/35396/2 "2020-11-26T13:40:03Z")

</div>

@“willem.lourens” Hi, that’s a lot of swap:) So the swap is just a partition, not a backing device or anything special? It should not matter if just discarded?

You can see what is being used via;

```auto
cat /proc/meminfo

```

What is the output from;

```auto
swapon -s

```

I would look at creating a smaller swap file eg 2GB (if not able to create a partition) and set the priority `see man 8 swapon` so it switches over to the other one.

Also if reducing to such a small amount, perhaps investigate the swappiness sysctl setting and reduce, so it uses the system RAM and less swap may help reduce until you can remove.

For example;

```auto
cat /etc/sysctl.d/98-server.conf
vm.swappiness=1
vm.vfs_cache_pressure=125

```

You will need to read up on the values, but this can be tweaked on the fly, the above conf file is so it sets up on boot.

---

<div class="post-metadata">

### Author: ![willem.lourens](https://avatars.discourse-cdn.com/v4/letter/w/35a633/32.png) [@willem.lourens](https://forums.suse.com/u/willem.lourens)
#### Post date: [November 30, 2020, 12:55pm UTC](https://forums.suse.com/t/swapoff-slow/35396/3 "2020-11-30T12:55:02Z")

</div>

Dear @malcolmlewis  
Yes only a huge swap partition, not sure what will happen if it is just discarded.  
Many thanks for your answer. I will have the opportunity to make changes again after month end, will confirm.  
Kind Regards,

---

<div class="post-metadata">

### Author: ![willem.lourens](https://avatars.discourse-cdn.com/v4/letter/w/35a633/32.png) [@willem.lourens](https://forums.suse.com/u/willem.lourens)
#### Post date: [December 14, 2020, 6:50am UTC](https://forums.suse.com/t/swapoff-slow/35396/4 "2020-12-14T06:50:23Z")

</div>

Dear @malcolmlewis  
“cat /proc/meminfo” showed a huge amount of swap in use. I changed the swappiness to 10 a week before the next attempt, and created the 2 GB swap file with a higher priority.

Over the weekend I could let the swapoff command run overnight. The next morning it was hanging still. I restarted the server, and this time the swapoff executed successfully.

Many thanks for the comment 😃
