How to merge two partitions

I would like to merge my sda2 and sda3 together to make one large partition. I don’t need a /home. And the SSD is only 120GB.

Here’s a screenshot.

Can I change the file systems and merge them together?

You can’t change the / partition of a running system. You need a live cd for changing it.
The best solution is GParted. You can resize the different partitions with that and you can remove the /home directory. Take a backup before resizing the partitions!
You can do it with the command line and the tool gpart, too.

It may be worth noting a few things before doing this.

  1. Your root (/) filesystem is BtrFS, which likely has snapshots enabled.
    Unless you define /home as a subvolume, you’ll now get snapshots of your
    personal data. That may be nice, but it may also use a lot of space
    unexpectedly and cause problems for you, particularly with a smaller drive.

  2. Unless you NEED more space for either the root (/) or /home
    filesystems, the effort to do this is probably not worth it, even
    considering #1. You’d be better-off adding a second drive.

If you really want to do this, you could potentially do this if you have
an external drive handy, or if you have a small amount of data in /home
right now. Some steps, if you have space in / rot /home’s current data,

  1. Login as root, preferably from a command line, so you do not need
    /home for this work.
  2. Unmount /home, and re-mount it to /mnt temporarily.
    2a. Be sure /home is defined as a separate BtrFS subvolume in Yast so
    that regular root filesystem (/) snapshots do not apply to it.
  3. Copy all data from /mnt to /home. If you lack space for this on /
    (which holds the /home directory now that the /home partition is
    unmounted), then you’re done and will need an external drive.
  4. Verify everything is as it should be under the /home directory, which
    is on your / partition.
  5. Remove the /home entry from /etc/fstab so that it does not try to
    mount in the future, since you’re about to get rid of it. Yast should
    take care of this in #6, but just be sure.
  6. Use Yast / Partitioner to delete sda3 and then grow sd2 to take its
    space. You may need to boot from external media to do this since you’re
    growing the root (/) filesystem which is currently in use by your running

If at step #3 you ran out of space, either delete stuff from /home (empty
your users’ trash) or else get external media and copy to that. A
good-sized USB stick could handle all of that, or any external hard drive
probably could. Once you have /home backed up, continue with steps 5 and
6 above, and then the last step is to copy data from whatever drive back
into /home which is now part of the root filesystem.

Good luck.

If you find this post helpful and are logged into the web interface,
show your appreciation and click on the star below…

One last note: In the future when building a system use LVM as the base so
that this is all potentially much easier, and maybe a little more
pointless. LVM is designed to break apart restrictions between hardware
(partitions) and filesystems by using logical physical volumes (as
partitions), logical volumes (which hold filesystems) and volume groups
(to make physical volumes available to logical volumes) which makes space
issues a bit easier to handle.

Good luck.

If you find this post helpful and are logged into the web interface,
show your appreciation and click on the star below…

Thank you all for the information. I think I’ll leave it alone. :wink:

  1. I also vote for GParted (Actually GParted Live, since your operations include the root partition)

  2. I don’t see mentioned, but I don’t think you can merge partitions which are formatted differently (/home would be formatted XFS while the root is BTRFS by default).

Depending on what is installed into the root partition, you may find it easier to simply move your /home to an external drive, re-install into a single partition and then copy your /home back to your system.


Just two remarks,

you can resize btrfs root partitions online, or even add other devices to btrfs. Snapper does not support boot into a read-only snapshot when installing into LVM. One has to configure a rollback manually then.

Best regards,