0

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. enter image description here

3 Answers3

0

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.

muru
  • 197,895
  • 55
  • 485
  • 740
  • 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
  • can you send more about resize2fs – Ramesh Manda Aug 03 '14 at 23:28
  • @RameshManda resize2fs only works if the space is after the partition, not before, like in your case. – muru Aug 03 '14 at 23:29
0

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
kyodake
  • 15,401
0

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.

  1. 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 /).
  2. Open Gparted. If it's not installed, install it using sudo apt-get install gparted.

  3. 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.

  4. 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.

Alaa Ali
  • 31,535