How to remove files hidden under /tmp mountpoint?

I recently created a RAM /tmp by adding this to /etc/fstab:

tmpfs /tmp tmpfs rw,nosuid,nodev,noatime   0    0

Everything works fine, and in theory the system runs faster now, but at boot time /var/log/syslog gets:

… tmp.mount: Directory /tmp to mount over is not empty, mounting anyway.

This situation seems inevitable, as there is never an opportunity to remove files from the filesystem version of /tmp.

The wasted space is trivial, but as a matter of interest, is there any easy way to clean out the junk hidden under the /tmp mountpoint?


Solution 1:

mkdir /mnt/root
mount --bind / /mnt/root

This will mount your root partition in /mnt/root. Current mountpoints are not affected, so when looking in /mnt/root, you will see the original directory contents.

Solution 2:

The 'easy' way is to boot from a Live USB/CD. Then, your mount won't have happened.