Announcement

Collapse
No announcement yet.

Can I separate completely the /home folder from root?

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [SOLVED] Can I separate completely the /home folder from root?

    Hey, guys!

    You see, I just installed two operating systems on VirtualBox, having my /home/user as the default folder for VMs. Now, I just received a system message telling me that the root partition, which is separated from the /home partition, is almost with no free space. So, and maybe it's a silly question but, what is the purpose of having the /home and root folders separated if the former is always dependent of the latter, so to speak? If the two directories are located in different partitions, why those virtual machines are still using space from root, which happens to be in another partition?

    Thanks in advance!

    EDIT: I just tried to install Disk Usage Analyzer to see what's taking so much space from root, but I couldn't install nothing due to lack of space! I have more than 100 Gigs of free space on my home partition, but almost no space now on root. I also noticed that my /home is mounted on /media/user/... I don't understand what mess I have or did during the installation, but since I did as usual (root in one partition and /home in another), I don't know what's happening.​
    Last edited by alex7779; Oct 01, 2022, 11:38 PM.

    #2
    I respond to my self... I think the better way to stop having those problems of space on root would be extending its size. If anybody has another idea, please lemme know.

    Comment


      #3
      Originally posted by alex7779
      ...what is the purpose of having the /home and root folders separated if the former is always dependent of the latter, so to speak?
      A reason would be the backup schedule.

      ​Some active members on this forum dislike he separation of root and home, and just have one partition. In my view it's good to separate data with different backup requirements. And separating VMs from other data makes sense IMO.

      Originally posted by alex7779 View Post
      I respond to my self... I think the better way to stop having those problems of space on root would be extending its size.
      Indeed. (Assuming the root with space problems is the host of the VMs, otherwise you'd just trash and recreate the VM). If you can boot the system, you could try
      Code:
      sudo journalctl --vacuum-size=100M
      to clean up some old systemd logs.

      How big are the partitions presently? I don't know anything about VirtualBox, and where it puts data. The size needed by an Ubuntu root partition has increased (from what it was a few years ago) by several GB thanks to "snaps"; on the system I'm typing this /var/lib/snapd has 2.6 GB.

      IIUC you'll have to move the home partition, and maybe shrink it, to make room to expand the root partition. You'll likely have to boot to a Live USB (the Kubuntu installer is good for this) because you can't move mounted partitions (at least I couldn't the last time I tried). A good backup would be strongly recommended.

      If anybody has another idea, please lemme know.
      Too late now maybe, but using btrfs would avoid this problem. By default Kubuntu uses separate root and home subvolumes and they share free space. But btrfs may not be suitable for your VMs. Because I backup at least weekly - when I'm diligent - I put VMs on a separate partition.
      Regards, John Little

      Comment


        #4
        Thank you, John!
        Code:
        $ df -Th
        Filesystem Type Size Used Avail Use% Mounted on
        tmpfs tmpfs 1.6G 1.7M 1.6G 1% /run
        /dev/sdb1 ext4 79G 42G 33G 57% /
        tmpfs tmpfs 7.8G 26M 7.8G 1% /dev/shm
        tmpfs tmpfs 5.0M 4.0K 5.0M 1% /run/lock
        tmpfs tmpfs 1.6G 72K 1.6G 1% /run/user/1000
        /dev/sdb3 ext4 98G 35G 58G 38% /media/alejandro/bdc6f254-4fff-4fcc-940a-5ef7ce68ec3e
        /dev/sda2 ext4 196G 14G 173G 8% /run/timeshift/backup
        /dev/sda1 fuseblk 732G 397G 335G 55% /media/alejandro/BACKUP

        VirtualBox uses /home/user/ for VMs files, and that's why I'm having problems with free space on root. What I'm trying to do is editing the fstab file to add the partition /dev/sdb3 so I can change the default path on VB to /media/alejandro/bdc6f254-4fff-4fcc-940a-5ef7ce68ec3e. I'm not gonna resize root, just gonna do what I mentioned.

        Comment


          #5
          Clearly, you should be mounting /dev/sdb3 in /etc/fstab. Whether you call it "home", to have a typical set up, or not is up to you. You could keep /home/user (presumably /home/alejandro) as the place for the VMs by moving everything presently in /home/alejandro to /media/alejandro/bdc6f254-4fff-4fcc-940a-5ef7ce68ec3e, unmounting it from /media then mounting it on /home/alejandro to check it out. Moving the files is tricky; you may prefer to do it with dolphin, with "show hidden files" on. To proceed cautiously, I would first add another user, with account type "Administrator", to avoid being stuck if you render your normal account unusable, and use that account to do the moving.

          The /etc/fstab entry would look like
          Code:
          UUID=bdc6f254-4fff-4fcc-940a-5ef7ce68ec3e /home/alejandro  ext4  defaults 0 2
          ​Note that just editing /etc/fstab doesn't change things immediately, though one can run sudo mount -a to make the system read it. The ownership of /home/alejandro might need to be reset to "alejandro:alejandro"; I'm not sure.
          Regards, John Little

          Comment


            #6
            OK. First I'm gonna create another user with Admin privileges, just in case.

            EDIT: I did it, but before editing the /etc/fstab file, I'd like to know more about what you said: The ownership of /home/alejandro might need to be reset to "alejandro:alejandro"; I'm not sure.
            Last edited by alex7779; Oct 03, 2022, 09:32 AM.

            Comment


              #7
              Originally posted by alex7779 View Post
              The ownership of /home/alejandro might need to be reset to "alejandro:alejandro"; I'm not sure.
              Usually the mount point of a file system is owned by root, but for the mounted /home/alejandro to be the home, it needs to be owned by alejandro. And when one mounts X on Y, I can't remember which of X or Y gives the permissions of the result; I expect it's X, but don't have a file system lying around to experiment with. Note that if one mounts X on Y, the contents of Y become inaccessible until X is unmounted.

              Regards, John Little

              Comment


                #8
                Thanks for the info, John!

                Comment

                Working...
                X