I have 2 unallocated partitions in my dual boot laptop. I want to add these two unallocated partitions to "/dev/sda5" partition. I to do in GParted.

- 49
-
You should be able to expand it by simply highlighting sda5 and click on Resize. That should allow you to adjust the size of the partition – ryekayo Aug 03 '14 at 22:42
-
I have important data in that partition. should i backup data to Resize the partition. – Ramesh Manda Aug 03 '14 at 23:06
-
It wouldnt hurt to tarball your /home, place the .tar in a flashdrive, and then attempt to resize it. – ryekayo Aug 03 '14 at 23:11
-
"Resize/Move" option is not enabled when i right click on the part/Partition option. only "Unmount" and "Manage flags" optitions are enabled. – Ramesh Manda Aug 03 '14 at 23:12
-
If you have the harddrive/usb mounted you need to unmount it first' – ryekayo Aug 03 '14 at 23:13
-
Yeah, click unmount and then resize. If you are running ubuntu from that hard drive, it will crash. I advise doing it from the live CD. – Tim Aug 04 '14 at 07:24
-
You might wish to look at Moving Space Between Partitions for an example on how to move space between primary and logical partitions by resizing the extended partition. – Curtis Gedak Aug 04 '14 at 19:26
3 Answers
To expand in GParted, the partition needs to be unmounted. So you cannot resize root (/
) from GParted. You can try the resize2fs
program from the command line (after using fdisk
to recreate the partition to the larger size with the same starting cylinder). That only works if the free space comes after the partition. So, in your case, the only option is to reboot to a live USB, resize the partition using GParted like @ryekayo said. This will cause your filesystem's UUID to change, so you will have to change the UUID in your fstab
, update GRUB, etc. (see this answer). It would be simpler to backup your home and reinstall.
-
Reinstalling OS is very complicated for me, because i have installed more than 10 physics related software such as "Mathemetica", "Matlab"...., which creates lot of problem to reinstall. – Ramesh Manda Aug 03 '14 at 23:24
-
@RameshManda then you can do resizing. The linked answer has steps very similar to what you have to do, just ignore the part about shrinking, since you already have space. Other steps are mostly the same. – muru Aug 03 '14 at 23:27
-
-
@RameshManda resize2fs only works if the space is after the partition, not before, like in your case. – muru Aug 03 '14 at 23:29
My suggestion is that:
Create a new partition.
Move your /home to her.
You create the partition with ext4 from gparted. (/dev/sda?)
You open a terminal and run:
sudo su
mkdir /media/hometemp
mount /dev/sda? /media/hometemp
cd /home
cp -ax . /media/hometemp
cd /
mv /home /home.old
mkdir /home
umount /dev/sda?
mount /dev/sda? /home
blkid /dev/sda? &&(The output will say: xxxxxxxxxxxxx)
nano /etc/fstab
&&Add these lines:
---------------------
#/dev/sda? was /home
UUID=xxxxxx /home ext4 defaults 0 2
---------------------
&&Save file (Control+O)
&&Close nano (Contro+X)
rm /home.old
reboot

- 15,401
Here's what you need to do.
NOTE: we're going to be moving
/dev/sda5
around. This process will take a long time because your partition is pretty big. It can take like 3 hours or something. Be prepared. Also, backup everything! I'm not responsible if something goes wrong.
Boot into a LiveUSB/CD. This is done by creating a bootable USB/CD of Ubuntu, as if you're going to install Ubuntu, but you'll choose Try Ubuntu instead of installing it.
- This runs Ubuntu off the USB/CD, think of it as "running Ubuntu in RAM". This will allow us to partition your hard disk. You have to do this because you're going to resize the main partition of your installed Ubuntu (called the "root partition", denoted by
/
).
- This runs Ubuntu off the USB/CD, think of it as "running Ubuntu in RAM". This will allow us to partition your hard disk. You have to do this because you're going to resize the main partition of your installed Ubuntu (called the "root partition", denoted by
Open Gparted. If it's not installed, install it using
sudo apt-get install gparted
.Right click on
/dev/sda5
and click Resize/Move. Drag the left arrow to the left to take over that empty space (grey area). If that doesn't work, then you'll have to first drag the box to the left, then drag the right arrow to the far right. If that doesn't work, then I think you'll have to do it in two steps. 1) Drag box to right. Click OK. 2) Drag arrow to right.Take a look at the GParted window now. You'll see that
/dev/sda5
has been resized. We're not going to do anything with the other unallocated space of size 1MB because moving it around will make the process longer, and it's useless for 1 megabytes =/.Once you're satisfied, click Apply to apply the changes we did and start the resizing. This is the part that will probably take a long time. Make sure your laptop is plugged in to a power source.
Run Boot Repair. This will fix boot issues because we moved
/dev/sda5
. You can install Boot Repair using the following commands:sudo add-apt-repository ppa:yannubuntu/boot-repair sudo sed 's/trusty/saucy/g' -i /etc/apt/sources.list.d/yannubuntu-boot-repair-trusty.list sudo apt-get update sudo apt-get install -y boot-repair && (boot-repair &)
Click on "Recommended Repair" when it opens.
Reboot your machine. Remove the USB/CD. You should now have a resized /dev/sda5
.

- 31,535