I have a system with a dedicated swap partition, running a custom distribution generated by Yocto.

On startup, during init, I can see the first swapon command successfully activating the swap space. A second swapon is sent, which subsequently fail (with a swapon failed: Device or resource busy since the swap partition has already been activated).

However, once fully started, I realised the swap space was not used by the system and is shown as deleted by swapon --show and cat /proc/swaps:

root@machine:~# swapon --show
Filename                                Type            Size    Used    Priority
/dev/mmcblk0p4 (deleted)                partition       1023996 0       -1

I wonder what causes the swap partition to be shown as deleted?


(deleted) appended to a file name output by the kernel is the standard behaviour for files which have been deleted (see d_path in fs/dcache.c — it’s well-documented, you don’t need to read C).

In this case, it means the device node /dev/mmcblk0p4 has been deleted for some reason. (This doesn’t mean that the partition itself has been removed, it’s just the device node.)

  • Thanks, but how come in a startup process a device node can be deleted? What kind of command should I be looking for? Can a rootfs re-mount cause this for example? – gromain Feb 28 '18 at 11:29
  • Yes, a re-mount could cause this, especially if udev isn’t re-triggered (assuming it’s used at all). A simple rm can remove a device node... However, I wouldn’t expect that to prevent the swap from being used. – Stephen Kitt Feb 28 '18 at 12:00
  • 1
    So I found out what it was in the end. Udev ended up loading a cache, and overwriting everything in /dev. I didn't need this functionality, so I just prevented it from happening. Thanks for the details! – gromain Feb 28 '18 at 15:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.