Practical questions for having /tmp and /var on same partition
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Practical questions for having /tmp and /var on same partition
Hi.
I just installed MX Linux onto a computer, and tough the installer does provide an option to have separate / /root /home and swap partitions, it does not natively offer the user to specify partitions to put /var and /temp.
Therefore, I have set aside 25BG free space for this purpose. I also want to put /var and /tmp on same one partition.
var and /tmp can be filled up by user programs or daemons. Therefore it can be safe to have these in separate partitions that would prevent /, the root partition, to be 100% full, and would hit your system badly. To avoid having two distinct partitions for these, it is not uncommon to see /tmp being a symlink to /var/tmp.
The first practical question - what steps are necessary to do this? According to last post in this askubuntu forum thread:
Quote:
if you provide an existing directory instead of the link name, ln will create a link inside that directory
You will probably have to do these steps from a rescue DVD. If you try them on a live system the system will probably crash part way through the rearrangement.
Format the new partition.
Move the contents of /var to the new partition leaving /var as an empty directory on /.
change /etc/fstab to mount the new partition on /var
delete /tmp on / and recreate /tmp on / as a symbolic link to /var/tmp
The only possible problem I see with what you are attempting is if the boot process uses /tmp before /var is mounted through /etc/fstab. I don't think that is what actually happens so I think it should work.
--------------------------
Steve Stites
Last edited by jailbait; 01-13-2021 at 07:43 PM.
Reason: format
The practice of putting /var and /tmp on separate partitions dates back through the mists of time when hard drives were still relatively new and extremely small. With today's hard drives, it should not be necessary.
I common allocate 25-30GB for my root partition, which contains everything except /home, and have never experienced any issues related the /var and /tmp. (Before I started doing that, I would have just one root partition containing everything, and also never encountered any issues.)
The only possible problem I see with what you are attempting is if the boot process uses /tmp before /var is mounted through /etc/fstab. I don't think that is what actually happens so I think it should work.
Good point!
systemd places files in /tmp
If these are overmounted, it might misbehave.
EDIT
I think it uses the /tmp later, not before mounting, so it is likely not a real problem.
Last edited by MadeInGermany; 01-14-2021 at 04:19 AM.
I think it uses the /tmp later, not before mounting, so it is likely not a real problem.
The new idea is to use /run.
Putting /tmp and /var on their own partition(s) is only useful for servers. There a lot of users may create a lot of data on /tmp, while databases typically make use of /var to keep track of things.
FWIW, /tmp is a tmpfs (aka RAM disk) on my system.
Major distros seem to disagree about what exactly /tmp should be, but I think that's the right way.
There's more:
FWIW, /tmp is a tmpfs (aka RAM disk) on my system.
tmpfs, AKA “a symlink to /dev/shm” or just any kind of ramdisk for temporary data should be a natural choice. I do not know if my use of the temp-directory qualifies me as a security-freak. But knowing that wiping RAM is quite different from wiping a hard-disk has its charms. – Knowing that not doing anything at all is enough for a RAM-disk, too.
Last edited by Michael Uplawski; 01-16-2021 at 01:25 AM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.