Score:0

How can I expand filesystem partition (ext4) ubuntu?

br flag

I need help in expanding a filesystem partition. I am now on dual boot Windows 10 (SSD) + Ubuntu 22.04 (HDD). I noticed that Ubuntu was installed on HDD as be seen below: gparted

I accidentally moved 50GB of unallocated space into /dev/sda2 while trying to extend my /dev/sda3 partition. I am trying to look into Q&A but can't sure about the solution. I don't wanna mess around and ended up wiping my entire HDD. However, my questions is:

  1. How do I shrink and move 45GB from /dev/sda2 to unallocated space?
  2. How do I expand my ext4? (from what I understand, you need to spare adjacent unallocated space around ext4, but I can't move and drag over the partition)

Any help appreciated, thanks!

HomerSimpson avatar
sa flag
Leaving 2 GB for esp is a lot. 500 Mb should be plenty enough.
WVXWV avatar
br flag
Solved! Thank you guys for giving responses, I ended up using gparted + minitool partition wizard (Windows). For those who wondering, basically to move certain sizes, you need to slice it like a birthday cake, and merge it later.
Score:3
cn flag

Do you have good backups? And major change means you backup must be current.

Shrink you FAT32 partition, leaving 100 to 500MB. Ubuntu may be using ESP on Windows drive, but I like to have ESP on every drive, but not required.

Reboot & make sure everything is ok.

Then you should be able to move sda3 left into unallocated space. This is the process that can take a while as all data is copied. Any interruption where part of data is copied corrupts it and only recovery is from backup.

Then you can expand sda3 right. That should be quick.

While gparted lets you queue steps, best to run each step & make sure it works before doing next one.

Joepie Es avatar
eg flag
To run each step and check is good advice. Forgot to mention that.
WVXWV avatar
br flag
I can't shrink FAT32 partition, last time I try with Ubuntu live too see: https://tinypic.host/i/yIhzh
oldfred avatar
cn flag
Is it getting mounted? Or does it have corruption and needs dosfsck? Does gparted show yellow or red icon? And right click on icon for info?
WVXWV avatar
br flag
It isn't mount because I boot into Try Ubuntu. It can't shrink because the arrow doesn't move like it stuck. I ended up shrinking through windoes :D
oldfred avatar
cn flag
Windows may have set something. So using Windows was a good option for FAT32.
Score:3
eg flag

Use the usb device you used to install Ubuntu.

  1. Choose try Ubuntu.
  2. Use GParted to shrink sda2.
  3. Check the UUID of sda3 and write it down/make a note in Kate e.g.
  4. Then move sda3 to the left.
  5. Expand sda3 with the unallocated space. This should now be on the right side of sda3.
  6. Check the UUID of sda3 again. If it is the same you don't have to do anything more.
  7. If it changed you need to change your fstab and grub.cfg. Just change the old number of the UUID for the new one ( as root ). Because you didn't delete sda2 I don't think the UUID will change though.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.