1

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 misleding SwapTotal value. That makes it rather hard to monitor swap usage unless I'm willing to use parse and sum swapon -s output. How can I purge these (deleted) devices or get SwapTotal to report good values?

3
  • Does free -m show it correctly?
    – Nathan C
    Jun 4, 2013 at 12:06
  • It doesn't, same numbers. Same goes for top and htop, they all use meminfo.
    – skrat
    Jun 4, 2013 at 14:07
  • I'm tempted to flag this comment :)
    – skrat
    Jun 4, 2013 at 20:37

1 Answer 1

0

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .