Consider this:
[skrat@apex geri]$ cat /proc/meminfo | grep SwapTotal SwapTotal: 18438120 kB [skrat@apex geri]$ swapon -s Filename Type Size Used Priority /dev/mmcblk0p2 (deleted) partition 3073020 0 10 /dev/mmcblk0p2 (deleted) partition 3073020 0 10 /dev/mmcblk0p2 (deleted) partition 3073020 0 10 /dev/mmcblk0p2 (deleted) partition 3073020 0 10 /dev/mmcblk0p2 (deleted) partition 3073020 0 10 /dev/mmcblk0p2 partition 3073020 583196 1000
Why is
meminfo
reporting total swap size including deleted swap files/devices? The reason it bothers me is that everytime the system gets suspended, these devices are remounted, every time adding new(deleted)
swap device, adding up to misledingSwapTotal
value. That makes it rather hard to monitor swap usage unless I’m willing to use parse and sumswapon -s
output. How can I purge these(deleted)
devices or getSwapTotal
to report good values?
Answer
According to Alasdair G Kergon: If you deleted an active swap file it then became impossible to ‘swapoff’. 2004, http://comments.gmane.org/gmane.linux.lvm.general/4949
If, each time you suspend your laptop, it is unloading the mmcblk driver, then this deletes an active swap device. Now it becomes impossible to swapoff. It does not prevent swapon
to work once this device is recreated, but for linux it is a different device, not the same device.
You should tell you laptop to swapoff /dev/mmcblk0p2
before each suspend. Either manually, before each suspend, or once for all in who knows which acpi script.
Attribution
Source : Link , Question Author : skrat , Answer Author : user2987828