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:

Note to self - use kubectl to query images in a pod or deployment

In both cases, we use JSON ... For a deployment, we can do this: - kubectl get deployment foobar --namespace snafu --output jsonpath="{...