[SOLVED]How to add unallocated space to ext4 root partition

Quick to answer questions about finding your way around Linux Mint as a new user.
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions use the other forums in the support section.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
Rogviparoc

[SOLVED]How to add unallocated space to ext4 root partition

Post by Rogviparoc »

Hello everyone

Would you please consider the following problem: the family PC is using Linux Mint 10 that was installed after Win XP.
The root partition has become too small and I resized the logical partition (hosting my F:/ ("Data") drive under Win XP) and was able to free some 30Gb.

My question may seem stupid but I cannot figure out a way to add this to my ext4 partition; can somebody plesae advise me ?

Many thnaks in advance,

R.

Attached you will find a screenshot of Gparted and the results of running command "sudo blkid", "sudo fdisk -l" and "sudo parted -l print".
Image
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
mintybits

Re: How to add unallocated space to my ext4 root partition

Post by mintybits »

Hi. Yes, you can use the free space.
First step is to back up any crucial linux data just in case something goes terribly wrong. Best to do the same for Windows.

There are at least 2 ways to do this.

1) The simplest way - resize sda2
Boot a live linux CD and run GParted.
Use GParted to resize sda2, moving its start to the left to use the free space. This operation may take quite a long time so be patient and do not interrupt it or your linux partition will be trashed.
When finished, reboot and confirm linux boots.

2) The safer way, but more complicated - copy sda2, make sure the copy works and then delete the original
Boot a live linux CD and run GParted.
Use GParted to extend the extended partiton sda4 to the right...so that it contains the unallocated space.
Use GParted to copy & paste sda2 into the unallocated space inside the extended partition. The copy will be called sda6.
Change the UUID of sda2 so it is different from sda6. Otherwise Grub will get confused when trying to boot. In a terminal:

Code: Select all

sudo tune2fs -U random /dev/sda2
Now reboot into linux.
Confirm you are booted into the sda6 linux

Code: Select all

mount
Reinstall Grub for good measure

Code: Select all

sudo dpkg-reconfigure grub-pc
Then reboot and confirm all is ok.

Now you can boot live CD and run GParted and delete sda2 and extend the extended partition to the right and then extend sda6 to fill the unallocated space.

Option 2) is only worth the hassle if you haven't got an easy way to restore sda2 if anything goes wrong. This option allows you to change the UUID of sda2 back to what it was and then delete sda6 and have your original set-up. To see the UUIDs for your partitions use

Code: Select all

sudo blkid
To change sda2 UUID to a particular value:

Code: Select all

sudo tune2fs -U <uuid> /dev/sda2
Rogviparoc

Re: How to add unallocated space to my ext4 root partition

Post by Rogviparoc »

Thank you very much for the detailed explanation.
I Will give it a try by next week-end (when I have plenty of time to mess things up :wink: )
I will keep you posted on this.
Rogviparoc

Re: [SOLVED]How to add unallocated space to ext4 root partit

Post by Rogviparoc »

Here is what I did:
- I edited the profiles of the users so they might use backupmint;
- backup of every users data to a portable HDD with backupmint;
- I edited the profiles of the users back to their regular user's profile;
- I used the latest GParted disc to resize the root partition.

Gparted did the job beautifully and there was not a single problem when rebooting.

Image
Now Linux Mint 10 has enough space.

Thank you mintybits. :D
Locked

Return to “Beginner Questions”