4

I have Ubuntu installed on my computer as a dual boot option. I made my root partition too small, and I was wondering if I can make it bigger without reinstalling Ubuntu. Is there any way to do this?

Below is the layout of my partitions. Ideally, I would reduce the size of the home partition, and increase the size of the root partition.

fdisk results:

Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 83F136D6-6E47-42AF-B60F-104693424105

Device Start End Sectors Size Type /dev/sda1 2048 2050047 2048000 1000M Windows recovery environment /dev/sda2 2050048 2582527 532480 260M EFI System /dev/sda3 2582528 4630527 2048000 1000M Lenovo boot partition /dev/sda4 4630528 4892671 262144 128M Microsoft reserved /dev/sda5 4892672 1357260799 1352368128 644.9G Microsoft basic data /dev/sda6 1869260800 1921689599 52428800 25G Microsoft basic data /dev/sda7 1921689600 1953523711 31834112 15.2G Windows recovery environment /dev/sda8 1357260800 1388511231 31250432 14.9G Linux swap /dev/sda9 1388511232 1417807871 29296640 14G Linux filesystem /dev/sda10 1417807872 1869260799 451452928 215.3G Linux filesystem

Partition table entries are not in disk order.

gparted results

Pablo Bianchi
  • 15,657
awoh
  • 41
  • Yes you can resize your partitions without re-install. Please copy/paste text into your question (a pic of text is much harder to read). If you tried doing it whilst "/" was mounted it'd not let you (you need to umount first), so just use your Ubuntu install media, run gparted from there and re-size will work. If you use grub on that system you'll likely need to re-install grub's mbr (so it points to the new location of /boot; but that's pretty easy) – guiverc Mar 05 '18 at 22:52
  • "so just use your Ubuntu install media, run gparted from there" What does this mean? Sorry, I'm very new to Ubuntu and I don't understand what this means. – awoh Mar 05 '18 at 23:08
  • I meant grab your install media & install it; reboot to run it & select "try ubuntu" so your (hdd/sdd / partition isn't in use). when its running, run gparted from within the 'live' ubuntu (ie. try-ubuntu from install media). it'll then treat your "/" partition as any other and let you resize it. I'd then reboot & see if it runs (if you use grub, it may fail getting to step 1.5; ie. you'll find yourself in grub.rescue; in which case you can enter commands to boot your system & fix it, or return to install media & fix from there... – guiverc Mar 05 '18 at 23:17
  • if grub needs fixing (note I'd ignore this until you need it as it may not be an issue) you can look at https://askubuntu.com/questions/831216/reinstalling-grub2-efi-partition – guiverc Mar 05 '18 at 23:19

2 Answers2

2

If you have a Ubuntu LiveUSB you can use gparted for this.

Step one is to log in to the existing Ubuntu partition and use something like unetbootin to create your USB install.

Once that is done, reboot the system into the LiveUSB version. From there you can use gparted.

(EDIT: I completely forgot that you can’t affect the system you have mounted and are logged into. You need to switch out of that first; hence the LiveUSB.).

You will find gparted under the system tools or by clicking on the icon at the top. You can also start it by typing “sudo gparted” in the terminal (ctrl-alt-t). Type in your password when it asks (you won’t see anything happen when you type) and hit enter.

But back up your info just in case BEFORE YOU BEGIN.

Because you are dual-booting, make sure you are working on the correct partition. You don’t want to crash the working one.

Sage
  • 71
0

Needles to say backup all your data before you attempt any changes to partitions. The following changes can be performed from within your OS environment and do not require a reboot.

sudo fdisk /dev/sda
  • Hit m for help and list your options.
  • Hit F to list unpartitioned space.

Assuming you do have unpartitioned space:

  • Hit n to add a new partition
  • Hit enter if you want to go with default, select p or l otherwise
  • Hit enter on the "First sector" option (let the system select what's best)
  • On "Last sector" indicate the size of the partition, for example: +10G (for a 10 GB partition) or +800M (800 MB), or whatever size you so desire, options are K,M,G,T,P. Make sure to add the "+" sign

After the last instruction, fdisk will create the partition as 83 type "Linux" by default, if you need to change this hit "t" to change this, if not, go to next step.

  • Hit p and review the partition table, if you are happy with the new partitions;

  • Hit w to write the changes or q to quit whitout modifying the partition table, all your data is safe if you use q.

All of this changes are possible using parted or gparted, however parted writes changes to disk on the fly, so it's very dangerous if you do not know exactly what you are doing, I recommend against it.

If you do not have unpartitioned space, you would have to delete a partition first. "I leave the tough choices to you of course"

Once the partition is created, you'll need to format and mount it, let's say your new partition is /dev/sda11:

sudo mkfs -t ext4 /dev/sda11

Then mount the partition on your directory of choice:

sudo mount /dev/sda11 /mountpoint_of_choice

Use your new mounted space to your heart's content.

muru
  • 197,895
  • 55
  • 485
  • 740
Helio
  • 171