Partition resize

After reading as many topics as I could find (not that many on this forum - old one had more like these) I decided to open a new thread for partition resizing tips and tricks.
Thing is, many of us (me included) have our machines for years and since then some of the original sizez for partitions become too small: usually /boot, but sometimes other too.

Many years used dd to make copies of the partitions especially when I was running ipfire on SDCards.
So I am quite familiar with this process, but today challenge is to resize that disk dump…

Today case: / is too small; /lib and /usr have each close to 1GB and whole / is 2GB
Temporary I have cleaned up /lib/firmware by removing firmware for devices not present on my APU board…

But I need to increase the /dev/sda3 that is mounted as /

Current status:
Disk /dev/sda: 14.9 GiB, 16013942784 bytes, 31277232 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x000dd6f5

Device     Boot   Start      End  Sectors   Size Id Type
/dev/sda1  *       2048   133119   131072    64M 83 Linux
/dev/sda2        133120  2146119  2013000 982.9M 82 Linux swap / Solaris
/dev/sda3       2146120  6340423  4194304     2G 83 Linux
/dev/sda4       6340424 31275183 24934760  11.9G 83 Linux
[root@silver-x86-64 ~]# df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        2.0G  4.0K  2.0G   1% /dev
tmpfs           2.0G   12K  2.0G   1% /dev/shm
tmpfs           2.0G  624K  2.0G   1% /run
/dev/sda3       2.0G  1.3G  549M  71% /
/dev/sda1        59M   31M   24M  57% /boot
/dev/sda4        12G  1.9G  9.2G  17% /var
/var/lock       8.0M   16K  8.0M   1% /var/lock
none            2.0G   39M  1.9G   2% /var/log/rrd
none            2.0G  492K  2.0G   1% /var/log/vnstat

As you can see I have a swap which I never used (I usually run my machine with swapoff because 4GB RAM are enough)

I can easily merge sda2 and sda3 in one partition while booting from an external drive (SDCard) but the trick what is going happen when I am going to dump content saved previously from sda3 to the newly increased partition:

  1. Will the size be reduced back to 2GB?
  2. Do I need to edit mtab or fstab to point to the new partition UUID?

Anything else?
Thank you!

Hi @hjkl

I also had that problem in the past. My solution was to do a backup, including logs, save the backup to a safe location and then do a full install from scratch and then restore my backup.

Result was that / was resized to current standards. As mentioned towards the end of blog post

Re-installation time and restore from backup was about 15 to 20 minutes and no problems having to deal with partition resizing etc. All done for you by the install. I did my re-install around April/May 2020.
Root is now ~25G with 4G used
Boot is ~110M of which 35M is used

+1 - I did the same. It seemed much easier than expected!

It is certainly possible to resize partitions with the right tools, if you know how to.

You should probably only do it, if you have some expertise in doing so.

The backup and reinstall method is clearly the easy and safe option.