LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This 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


Reply
  Search this Thread
Old 01-13-2021, 06:33 PM   #1
Grobe
Member
 
Registered: Aug 2019
Posts: 36

Rep: Reputation: Disabled
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:
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
I've made symlinks before, but this confuses me.


Thanks in advance
 
Old 01-13-2021, 07:42 PM   #2
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Mineral, Virginia
Distribution: Debian 8
Posts: 7,890

Rep: Reputation: 338Reputation: 338Reputation: 338Reputation: 338
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
 
Old 01-13-2021, 07:56 PM   #3
Grobe
Member
 
Registered: Aug 2019
Posts: 36

Original Poster
Rep: Reputation: Disabled
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.
 
Old 01-13-2021, 09:15 PM   #4
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 16,917
Blog Entries: 27

Rep: Reputation: 5173Reputation: 5173Reputation: 5173Reputation: 5173Reputation: 5173Reputation: 5173Reputation: 5173Reputation: 5173Reputation: 5173Reputation: 5173Reputation: 5173
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.)
 
Old 01-14-2021, 04:16 AM   #5
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 1,560

Rep: Reputation: 708Reputation: 708Reputation: 708Reputation: 708Reputation: 708Reputation: 708Reputation: 708
Quote:
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.
 
Old 01-14-2021, 11:55 AM   #6
DavidMcCann
LQ Veteran
 
Registered: Jul 2006
Location: London
Distribution: PCLinuxOS, Xubuntu
Posts: 5,685

Rep: Reputation: 2055Reputation: 2055Reputation: 2055Reputation: 2055Reputation: 2055Reputation: 2055Reputation: 2055Reputation: 2055Reputation: 2055Reputation: 2055Reputation: 2055
Quote:
Originally Posted by MadeInGermany View Post
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.
 
Old Yesterday, 02:42 AM   #7
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 16,538
Blog Entries: 10

Rep: Reputation: 4879Reputation: 4879Reputation: 4879Reputation: 4879Reputation: 4879Reputation: 4879Reputation: 4879Reputation: 4879Reputation: 4879Reputation: 4879Reputation: 4879
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
run /run tmpfs rw,nosuid,nodev,relatime,mode=755 0 0
tmpfs /dev/shm tmpfs rw,nosuid,nodev 0 0
tmpfs /sys/fs/cgroup tmpfs ro,nosuid,nodev,noexec,size=4096k,nr_inodes=1024,mode=755 0 0
tmpfs /tmp tmpfs rw,nosuid,nodev,size=3538532k,nr_inodes=409600 0 0
tmpfs /run/user/1000 tmpfs rw,nosuid,nodev,relatime,size=707704k,nr_inodes=176926,mode=700,uid=1000,gid=1000 0 0
 
Old Today, 01:22 AM   #8
Michael Uplawski
Senior Member
 
Registered: Dec 2015
Location: Outside, most of the time.
Posts: 1,028
Blog Entries: 27

Rep: Reputation: 597Reputation: 597Reputation: 597Reputation: 597Reputation: 597Reputation: 597
Quote:
Originally Posted by ondoho View Post
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; Today at 01:25 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Is it practical to mount swap /var and /tmp on a fast SD card to save the SSD? FiftyOneFifty Linux - Desktop 5 02-10-2012 10:20 PM
mount /home, /var and /tmp to the same partition Kwahab Linux - Software 7 10-14-2009 02:14 AM
how to securing /tmp , /var/tmp and /dev/shm hackintosh Linux - Security 7 10-18-2007 12:26 AM
kde, /tmp, /var/tmp and all that garba Linux - Software 4 06-17-2005 01:31 PM
Newbie question - /tmp /var/tmp Mr happy Linux - Security 3 01-27-2003 02:03 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:01 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration