Can I have separate / and /tmp but /home + /var on one partition somehow?

Separate /tmp is good because I can set it up with some quick unreliable filesystem. I often change distributions therefore separate / is a blessing - quick re-install and I'm good as long as /home and /var are untouched.

The problem is, I don't want to designate space for any of the last three - I want them to share available resources. I sometimes need more space in /var and I can see there's available space in /home that I cannot use, sometimes it's the other way around. It's frustrating. Any ideas?

  • You don't separate / and /usr anymore. You can't do reinstalls leaving /usr untouched either (and /var not completely). – frostschutz Oct 19 '16 at 11:37
  • 1
    Why? Any sources on that? What is a good practice regarding partitions separation then? – cprn Oct 19 '16 at 11:45
  • 1
    @Cyprian, freedesktop.org/wiki/Software/systemd/separate-usr-is-broken (it's by the systemd folks but not directly related to it) – ilkkachu Oct 19 '16 at 20:55

You can always mount your third partition somewhere (like /mnt/combo or something), and then bind-mount subdirectories from this mountpoint to the three designated directories.

In fstab, this would look something like

UUID=... /mnt/combo        auto    defaults
/mnt/combo/usr /home        none    bind
/mnt/combo/var /var        none    bind
/mnt/combo/home /home        none    bind

Also consider this: /home makes sense to live on a separate partition - even better, a separate drive, which can be somehow protected (raid, backups,...). /var would make sense to be separate if you really have something personal in there (websites and such), otherwise it makes no difference. /usr can definitely be part of /, it makes no sense to have it separate because on a modern system, the distinction between /bin and /usr/bin is blurred and noone cares about it anymore, and segmenting a system only creates problems if one of the partitions somehow doesn't mount.

/tmp should normally be ram-backed anyway (tmpfs), unless you really are running out of RAM, and most distros do that by default unless you change it.

Big picture: separate /home if you have to, the rest is just overhead - you probably have no reason to have different filesystem types or different permissions on any of these, and partitioning doesn't usually mean physical separation (same hard drive?).

  • How would that work during reinstall? Each time I reinstall it would write to /home, /usr, /var on root partition and afterwards I would manually "replace" mountpoints with /home, /usr and /var from my /mnt/combo? – cprn Oct 19 '16 at 11:47
  • Yes, that would work, if that's what you want. But then, what does a reinstall even do? You usually want to keep configuration, so keeping /etc/ is more important than the rest, and there isn't much outside /usr anyway on a fresh install (/boot and that's it). If you want the install to write to these partitions, you'll simply have to mount this before running installation. – orion Oct 19 '16 at 11:50
  • @CyprianGuerra take a look into kickstart files. They automate tasks during installation. If you're worried about the configuration disappearing between installs a kickstart can help you out. – Centimane Oct 19 '16 at 12:22
  • Okay, I'm marking this as a valid answer because it resolves my question... I have to re-think my idea of reinstall, though, but this is a separate issue. And no, I don't think I want to keep configs because I use reinstall as the last resort when I'm lost trying to fix whatever I broke and need a working system ASAP, default configs, default packages. – cprn Oct 19 '16 at 15:56
  • 1
    In that case, in my opinion, it's better to wipe clean the /usr too. Because package repositories change. Things get updated. Very likely, old applications wouldn't work with fresh install. I would strongly recommend to just have a list of packages you want... and write a script that would quickly install everything, always the same things - and maybe simulatenously fix the things you want personalized (hostname, network config,...). A simple shell script that does the full system install. Otherwise you'll spend hours debugging when compatibility breaks. – orion Oct 19 '16 at 16:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.