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. On this page - unix.stackexchange.com/../why-put-things-other-than-home-to-a-separate-partition it says: Quote:
Quote:
Thanks in advance |
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 |
Thanks a lot #jailbait, that make sense. See if I got time to test this tomorrow.
If it get problems with this, it's a newly OS installed so not much time wasted anyway. |
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.) |
Quote:
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. |
Quote:
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: Code:
$> grep -w tmpfs /etc/mtab |
Quote:
|
2 Attachment(s)
Ok - I've made an attempt, this is as far I got:
However the editing of /etc/fstab file I don't know how to proceed further from this. From what I read, fstab can only deal with volumes and not folders within. As it sits now, the system are not able to boot (see screenshot of the boot error messages) attempt 1 : the symlinks does not include "/dev" (probably wrong anyway) attempt 2 : the symlinks does include "/dev" --> "dev/sda5/mx_var/" So far, the /etc/fstab file are not changed in any way. |
Why not just put /var in tmpfs?
Code:
*grep -w tmpfs /etc/mtab Code:
*cat /etc/fstab |
I wouldn't do it with symlinks. I'd just have empty /var and /tmp directories on the root partition and put them into fstab as mountpoints. In most modern distros /tmp is empty anyway and a tmpfs (ramdisk) is mounted there.
re your query about unnamed symlinks: Quote:
Code:
ln -s target . Code:
ln -s target /other_directory Your images show a successful boot though some daemons have failed. The acpi errors are not serious. It might be worth logging in and exploring the system to find out what the /var and /tmp directories actually contain. |
Thanks @craigevil
Yep - tempfs is an alternative. However, If I stuck to the plan and have to use fstab, the issue is that the first column of fstab file cannot point to a folder within any partition/volume. |
The whole /var in tmpfs is not a good idea, many setups use data stored there, must survive reboot. First column can have directories, use bind mount for those.
|
Quote:
And set up /tmp as a tmpfs if it isn't that way already. |
Ok, so I ended up no being able to restore the MX desktop, despite attempting to copy the contents of /var back again (created the /tmp and /var folder and copied back it's content in order to try to fix the MX desktop issue).
But - no problem, it's a test setup for this purpose anyway. So for now - lessons learned as following:
|
All times are GMT -5. The time now is 10:30 AM. |