swap:clear_swap
Differences
This shows you the differences between two versions of the page.
swap:clear_swap [2017/04/03 15:43] – created peter | swap:clear_swap [2019/12/04 21:41] (current) – removed peter | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Swap - Clear swap ====== | ||
- | |||
- | Check your swap usage: | ||
- | |||
- | <code bash> | ||
- | free -m | ||
- | |||
- | total | ||
- | |||
- | Mem: 1024 157 866 0 | ||
- | |||
- | -/+ buffers/ | ||
- | |||
- | Swap: 127 | ||
- | </ | ||
- | |||
- | where | ||
- | |||
- | * **-m** is for the value to be listed in megabytes. | ||
- | |||
- | |||
- | To clear the swap: | ||
- | |||
- | <code bash> | ||
- | sync && / | ||
- | </ | ||
- | |||
- | where | ||
- | |||
- | * **sync** is to force changed blocks to disk and update the super block; | ||
- | * **sysctl vm.drop_caches=3** is to free pagecache, dentries and inodes; | ||
- | * **swapoff** is to turn off swap; | ||
- | * **swapon** is to turn swap back on. | ||
- | |||
- | |||
- | Check the swap again: | ||
- | |||
- | <code bash> | ||
- | free -m | ||
- | |||
- | total | ||
- | |||
- | Mem: 1024 157 866 0 | ||
- | |||
- | -/+ buffers/ | ||
- | |||
- | Swap: 127 | ||
- | </ | ||
swap/clear_swap.1491234196.txt.gz · Last modified: 2020/07/15 09:30 (external edit)