0

I found this tutorial on how to move to home to a separate partition now that I feel I should also move /usr, /tmp and /var to the same partition, can I just do that in a similar manner. Add another two lines in fstab for tmp and usr with the UUID same as /home as described in the article and it'll be done? How to go about it?

3
  • Why would you want to do that? The reason to have separate partitions is to isolate unrelated subsystems from each other. The drawback is that you often end up with half-empty partitions with reserved but unused space. If you want to avoid that, don't have multiple partitions. If you don't mind, make new separate partitions. Either way, resizing the home partition would make more sense than making it share space with /usr etc.
    – tripleee
    Jul 17, 2017 at 18:04
  • Okay recently I tried to install unity for game development and it said no enough space. My home is mounted on a separate partition with almost 50gb left. So the errors messages revealed it could not write to /usr /var due to no space. If anything didn't have space it was the partition that the OS resides which only had about 1.5gb left. I thought moving /home to separate partition alone would mean that OS is alone in another one. These errors made me think that I should /usr /tmp /var to the home partition too. Plus when I googled it seemed common that's why I asked.
    – Nobody
    Jul 17, 2017 at 18:22
  • I probably got most of my assumptions wrong there. But I'd be glad if you could clarify any of it, if you could. Even redirecting me to a article is fine. Thank you.
    – Nobody
    Jul 17, 2017 at 18:23

1 Answer 1

1

While you cannot directly mount multiple filesystems from the same partition because each partition can only contain one filesystem, you can use LVM.

LVM-based solution

For example, with an unused partition, say /dev/sda3, you can do something like this:

pvcreate /dev/sda3
vgcreate vg0 /dev/sda3
lvcreate -ay -L5G vg0 lv-home
lvcreate -ay -L5G vg0 lv-usr
lvcreate -ay -L5G vg0 lv-tmp
lvcreate -ay -L5G vg0 lv-var
mkfs.ext4 -L HOME /dev/vg0/lv-home
mkfs.ext4 -L USR /dev/vg0/lv-usr
mkfs.ext4 -L TMP /dev/vg0/lv-tmp
mkfs.ext4 -L VAR /dev/vg0/lv-var

The commands above:

  1. Turns the partition into an LVM physical volume
  2. Creates an LVM volume group with the physical volume.
  3. Creates a logical volume for each filesystem.
  4. Puts a filesystem on each logical volume (with labels)

Next, setup fstab to mount each of the filesystems. Something like this:

LABEL=HOME   /home      ext4    defaults      0  2
LABEL=USR   /usr      ext4    defaults      0  2
...

PS

I don't recommend fragmenting your installation this way because you'll eventually end up with more not enough space errors, but nevertheless, that's one way to do it. Frankly, I'm a single-filesystem sort of guy, so if I were using Ubuntu I'd simply backup /home and restore it after an upgrade; no monkey business with partitions or logical volumes.

Warning

With both the original article and my instructions above, do your research BEFORE you run the commands. Understand what the commands do and their consequences. man is your friend.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .