0

I have Linux Ubuntu intalled on partition, that have about 19 GB. I want to make it bigger, to about 40 GB. I have that space unallocated. In GParted (live cd) I have resize option, but i cant make it larger.
How to make it bigger (or link linux partition to the new partition).
I have hitachi HDD, alongside the Windows 10, that not working.

The output of parted -l:

Number  Start   End    Size    File system     Name                          Flags
 1      1049kB  630MB  629MB   ntfs            Basic data partition          hidden, diag
 2      630MB   735MB  105MB   fat32           EFI system partition          boot
 3      735MB   869MB  134MB                   Microsoft reserved partition  msftres
 4      869MB   329GB  328GB   ntfs            Basic data partition          msftdata
 5      329GB   330GB  514MB   ntfs                                          hidden, diag
 6      330GB   330GB  367MB   ntfs                                          hidden, diag
 7      330GB   456GB  126GB   ntfs            Basic data partition          msftdata
 8      456GB   477GB  20,8GB  ext4
 9      477GB   481GB  4194MB  linux-swap(v1)

screenshot

Byte Commander
  • 110,243
Kacper
  • 3

2 Answers2

2

From the screenshot we see that there are 17GB of unpartitioned space at the end of the drive. We see that there is only the swap partition (/dev/sda9) between the / (/dev/sda8) partition you want to grow and the free space. So we can do this in few simple steps, even from your running system without having to boot from a live disk:

  1. Launch gparted.

  2. Unmount the swap partition (/dev/sda9) by right-clicking on it and selecting Swapoff from the context menu.

  3. Move the swap partition (/dev/sda9) to the end of the drive.

    Therefore right-click on it and select Resize/Move. In the appearing dialogue simply grab the block in the graphical visualization with your mouse cursor and drag it to the right border, so that finally the Free space following (MiB) shows a value of 0 (or maybe a bit more, depending on the alignment). Then click the Resize/Move button to confirm.

    You will get a warning that moving partitions can lead to data loss. Confirm it if you can stand the risk (because you have backups that are up to date). But as we're only moving the swap partition, nothing should happen anyway.

    Then the moving task will be added to the queue, but not executed yet. We're doing that later.

  4. Enlarge your / (/dev/sda8) partition.

    Therefore right-click on it and select Resize/Move. In the appearing dialogue simply grab the block's right border in the graphical visualization with your mouse cursor and drag it to the right border, so that finally the Free space following (MiB) and the Free space preceding (MiB) show a value of 0 (or maybe a bit more, depending on the alignment). Then click the Resize/Move button to confirm.

    Then the resizing task will also be added to the queue, but not executed yet. That's what we're doing now.

  5. Confirm that in the lower section of the GParted window you see exactly (and only) those two tasks:

    • Move /dev/sda9 to the right
    • Grow /dev/sda8 from 19GB to 37GB.

    If this is the case, click the green tick button in the toolbar that says Apply all operations.

    Another confirmation dialogue will pop up where you click Apply to continue.

  6. GParted will start its work now. Wait until it's done.

  7. Reactivate your swap partition (/dev/sda9) by right-clicking on it and selecting Swapon from the context menu.

    As you did not delete the partition but just move it, both its /dev/sda8 name and its UUID remained the same and Ubuntu will still recognize it on boot without any further configuration.

  8. Finally you can exit GParted. Finished.

Byte Commander
  • 110,243
0

You not have enough contiguous space for Partition 8 to grow because of the location of your swap partition. You will need to delete the swap partition and recreate it, which will change it's UUID (how fstab knows partitions).

1) Boot into your live environment
2) Delete your swap partition and commit the change
3) Resize your root ext4 partition as needed and commit it
4) Recreate your swap partition and commit the change
5) Reboot (it will take an extra minute or two and you will get an error, but it should boot normally after that)

Now we need to make a change to /etc/fstab to bring the swap back online.

1) Login and open a terminal window and execute blkid which will give you output something like this:

acejavelin@Mint-p6310f ~ $ blkid /dev/sda1: LABEL="System Reserved" UUID="3C9CD85F9CD8156C" TYPE="ntfs" /dev/sda2: LABEL="Win7Pro" UUID="345CDCC65CDC8450" TYPE="ntfs" /dev/sdb1: UUID="d7dd7c87-050c-4dac-ba59-1e07fade2599" TYPE="ext4" /dev/sdb2: UUID="c22cf1cc-08f5-4995-a2d8-cca62125351d" TYPE="swap" /dev/sdb3: UUID="c5e1f6de-2a75-4507-8d09-285f18296915" TYPE="ext4" /dev/sdb4: UUID="b190e13f-699d-4005-bf5c-3500e888b281" TYPE="ext4"

Make note (or copy to the clipboard) of the UUID in the line with TYPE="swap" as we need that to make in change.

2) Start editing the file with sudo nano /etc/fstab
3) Look for a line similar to this:

UUID=c22cf1cc-08f5-4995-a2d8-cca62125351d none swap sw 0 0

and change the UUID to the proper one we found above and save the file.

4) Reboot and you should be all set

RELATED: How to edit files in a terminal with nano