Skip to content
Advertisement

How to store data permanently under /tmp in linux?

Before anyone gets bent out of shape saying you’re not supposed to do that and the like:

I am currently working with a router with very limited disk space running OpenWRT. I need to install a few programs. Looks like there is plenty of space under /tmp, but nowhere else due to how the file system is partitioned. Looking to store some files under /tmp permanently. I also preferably don’t want to interfere with the normal system operation of purging /tmp on reboot however, so changing how often the purge happens (50 years…) isn’t really what I’m looking for.

Brainstorms:

  • Is it possible to put permissions on select files under /tmp that I want to protect which will make them undeletable?

  • Is there an exclusion .conf for the purge process so the system knows not to touch these files?

  • ?

I’m a somewhat shallow/broad guy. Need some knowledge from some of the deep/narrow individuals among us.

Thanks.

ps: For reference: How to store data permanently in /tmp directory in linux

That thread doesn’t answer what I’m trying to do and due to the format of this website it’s not possible to add questions to existing questions, hence the new question posted here.

To clarify:

root@GL-AR150:/# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                10.0M     10.0M         0 100% /rom
tmpfs                    29.1M    796.0K     28.4M   3% /tmp
/dev/mtdblock5            4.3M    792.0K      3.5M  18% /overlay
overlayfs:/overlay        4.3M    792.0K      3.5M  18% /
tmpfs                   512.0K         0    512.0K   0% /dev

There is 3.5M free under /, which is not enough space for what I need to do. There is 28.4M free under /tmp.

Ideas?

Advertisement

Answer

By your df summary, /tmp is a tmpfs — meaning it is not “real” storage — its a RAM filesystem whose contents will be lost whenever the power goes off.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement