Monday, 7 March 2022

Ubuntu, where's my stuff ( in /tmp ) ?

At present, I'm tinkering with Kubernetes on Ubuntu 18.04.6 LTS, and had placed some "important" files in /tmp.

And then I rebooted ....

And, of course, /tmp was cleared ... 🙀🙀🙀🙀

This is, of course, configurable 

A quick Google took me here: -

How is the /tmp directory cleaned up?

TL;DR; there's a daemon for that: -

man tmpfiles.d

which includes: -

<snip>

       Example 3. Create a directory and prevent its contents from cleanup


       abrt(1), needs a directory created at boot with specific mode and ownership and its content should be preserved from the automatic cleanup applied to the

       contents of /var/tmp:


           # /usr/lib/tmpfiles.d/tmp.conf

           d /var/tmp 1777 root root 30d

</snip>

I tested this by creating the requisite file: -

vi /etc/tmpfiles.d/tmp.conf

containing: -

d /tmp 1777 root root 20d

and placed a dummy file in /tmp: -

touch /tmp/dave

and then rebooted.

And ... /tmp/dave is still there

Which is nice!

No comments:

Reminder - installing podman and skopeo on Ubuntu 22.04

This follows on from: - Lest I forget - how to install pip on Ubuntu I had reason to install podman  and skopeo  on an Ubuntu box: - lsb_rel...