Extending '/' partition and adding '/home' to this partition

During the initial installation of Fedora on my laptop, I created three different partitions for ‘/boot’, ‘/’ and ‘/home’ (since I read somewhere that this was the way to go). I’ve now noticed that almost all programs get installed on the partition where ‘/’ is, which leaves me with a full partition where ‘/’ is mounted and a ‘/home’ partition that has plenty of space.

How do I mount ‘/’ and ‘/home’ on one single big partition without losing my data and settings? Can I easily transfer ‘/’ to the same partition where ‘/home’ lives without problems? If so, how would I do this?

(some additional details)

  • I can’t directly mount ‘/home’ to the partition where ‘/’ is mounted since this partition is full atm.
  • I have a small USB which can run Gparted live to modify the partitions on my main disk.
  • I have a 64 GB USB to backup data if needed.

lsblk -f:

├─sda1
│    vfat   FAT32 SYSTEM
│                       601A-3350                              35,3M    63% /boot/efi
├─sda5
│    ext4   1.0         51ca5365-f0df-4645-8fe0-7158de555f42    1,5G    15% /boot
├─sda6
│    ext4   1.0         0cb8b84a-a4fe-4aa0-8f04-4da55572398a    1,9G    89% /var/lib/snapd/snap
│                                                                           /
└─sda7
     ext4   1.0         b4d19ade-c5bc-469f-b075-7b3014b2eb35  171,1G    10% /home

Thanks in advance for all responses!

1 Like

Are both / and /home btrfs partitions?

If so, you can just replicate a snapshot of / to you the other partition and then move/expand it.

1 Like

Sadly, they’re not BTRFS, they’re both EXT4-partitions.

You might simply boot the live install media, download and install gparted into that environment (easily done with dnf), then use gparted to resize the partitions. Shrink /home and leave the free space next to /, then expand / into the newlly available space. You cannot shrink a partition while the file system is mounted, but booting to the live install media avoids those issues.

This is one action that gparted is very good at performing. It resizes the partition and file system and relocates the data as needed.

We probably could give more detailed answers if you were to post the output of lsblk -f so we could see the device, partitions, and file systems involved.

1 Like

Thanks for your response.

This could be a solution, but as I’d like to prevent this in the future, I’d like for both ‘/’ and ‘/home’ to be mounted on the same partition.

Most people find that /home continues to grow while the root partition doesn’t grow a lot after the original installation. If there is a problem causing the root partition to use excessive space, we need to identify it rather than just treating a symptom.

If the document that suggested separate partitions also recommended sizes, it was probably based on typical user experience, so it would help to know if your space requirements are atypical. Note that users who habitually install 3rd party software and data as “root” may end up with a lot of data in the /root directory. Some 3rd party software is intended to install under /opt.

Resizing partitions is a high-risk activity due to possibility of “user error” (even experienced users make mistakes – I started with Unix over 30 years ago and still make mistakes) and higher than normal stress on filesystems and other components which can result in a hardware failure (one that was going to occur in the future). Make sure important files are backed up (preferably to more than one device).

Did you mean move /home into /? Home is normally mounted on “/”, and the terminology is: “root partition is mounted as /”.

Full partitions place stress on the hardware. Inexperienced users often end up with data in odd locations. Please post the output from running df -lTH / /home in a terminal (as text, using the </> button. This will give us a starting point. Then post the output of sudo du -sm /boot /etc /home /lib /lib64 /media /opt /root /usr /var (also as text) so we understand how space in the root partition is being used.

The first step is to understand why your root partition is full. The advantage of having a separate /home partition is ease of backing it up and preserving it across updates.

1 Like

Is there a particular reason why you followed what you “read somewhere” rather than the Fedora defaults? This is not meant to criticize your decision but to find out what (if) we can do to better communicate our defaults in the installer.

I used to have the exact same woes that you had, but jumped onto the btrfs train when it seemed stable, and couldn’t be happier. btrfs is the default nowadays. In particular, our default creates “partitions” for / and /home, or rather (in btrfs terms): subvolumes. So you have the same separation as before, can mount them separately if needs be, take separate snapshots etc. But we create only one disk partition for the btrfs “volume”, and consequently the available space is available for all subvolumes without any restriction (unless you want to set up quota).

Now, I don’t know whether you’re in a situation where you can or want to recreate your installation from scratch and copy home over from a backup. But depending on how complicated (tight space) and risky (file system extension in place) your ext4 partition reorganization is, opting for a btrfs default layout from scratch might be the same amount of work if not less, and certainly is more future proof (against new partition size woes).

1 Like

FIrst of all, thank you for your exstensive answer!

To be clear, I’m trying to put ‘/home’ and ‘/’ together on the same partition.

The /root directory only takes up about 300 MB, so this shouldn’t be the problem. The problem seems to be that all Flatpak, Snap and normal programs get installed on the sda6 partition (under var), which is considerably smaller than the /home partition.

The output from df -lTH / /home:

Filesystem     Type  Size  Used Avail Use% Mounted on
/dev/sda6      ext4   32G   30G  423M  99% /
/dev/sda7      ext4  217G   23G  184G  11% /home

The output from sudo du -sm /boot /etc /home /lib /lib64 /media /opt /root /usr /var:

354	/boot
32	/etc
21589	/home
0	/lib
0	/lib64
1	/media
1380	/opt
318	/root
6973	/usr
23855	/var

To be honest, I don’t quite remember the installation clearly anymore. I do remember that I had the option to mount different directories on different partitions instead of having everything on the same partition, which is why I searched the internet for if and how I should do this.

As a Linux-semi-noob, it would be helpful to have a small explenation during this partitioning part of the installation where it would give a small explenation on the partitioning itself (why you should or should not mount directories on different partitions, which file system is best for you, etc). I feel like Fedora is a pretty accessible distro for new Linux users, but as a Windows user who barely ever has had to deal with partitioning, this process during the installation can be quite confusing.

Since I’ve had this problem, btrfs seems like a dream. Unfortunately, I’m emotionally not ready to fully reinstall my Fedora yet as I’ve put a lot of work into the setup and customization :').

Please be wary of the mount points of your system root and home, do not confuse them with the live system root. The paths I gave should be adjusted accordingly.

I would proceed as follows from a live system:

  • Move all of /home data temporarily somewhere esle using mv.
  • Delete the /home partition
  • Resize the / partition to take the full space
  • Create /home on your root:
sudo mkdir /home
sudo chmod 755 /home
sudo chown root:root /home
  • Create your user directory:
sudo mkdir /home/your_username
sudo chmod 710 /home/your_username
sudo chown 1000:1000 /home/your_username
  • Move your data back to the new home (be aware of the hidden directories).
  • Remove the /home mount entry from /etc/fstab
  • Finally, add .autorelabel to your root to fix SELinux context and avoid being unable to login.

There is ample space to carry out the steps given by @computersavvy. You might consider just moving the large /var directories with flatpak and Snap data to sda7. Then you can use symbolic links in /var to recreate the original directory structure. This minimizes the amount of
data being moved around.

Understandable. I keep notes of customizations and avoid making changes that aren’t really necessary. This makes it easier to reinstall, but also means that discussing any issues that I encounter is easier because other users will have a similar configuration. If a customization is
really necessary it should be reported to upstream so everyone can benefit.

As for btrfs versus ext4 – there are many negative comments based on earlier versions of btrfs that scare people off. Btrfs is very different from traditional filesystems, so some issues may exist, but the vast majority of filesystem issues these days are due to drive failures. Storage is now cheap, so it is not unreasonable to have multiple backups and be prepared to restore the filesystem to new hardware if the media fails or the existing hardware if btrfs glitches.

This is what the default ‘automatic’ partitioning is used for. It makes creation of the drive partitions and their use totally automatic and the user has no need to follow often outdated, and sometimes just wrong, posts and suggestions as to how the file systems should be structured.

The intent has always been moving from the original ‘it takes an experienced user to do things right’ to the current ‘installation is almost easy enough for a total novice’. The old and outdated tutorials still cause problems.

2 Likes