Score:0

Can't increase the root partition size on Ubuntu 20.04

cw flag

I am currently using ubuntu 20.04 (AWS Ec2) machine. My root filesystem has no more space as per the below output

sudo df -h

Filesystem      Size  Used Avail Use% Mounted on
/dev/root       7.6G  7.6G     0 100% /

I have increased the Virtual disk volume (EBS Volume) to 10G. Please see the below output

lsblk

NAME     MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
xvda     202:0    0   10G  0 disk 
├─xvda1  202:1    0  7.9G  0 part /
├─xvda14 202:14   0    4M  0 part 
└─xvda15 202:15   0  106M  0 part /boot/efi

Now i have tried to extend the root partition (/dev/xvda) using cfdisk command as shown below.

Device                                                Start                         End                     Sectors                     Size Type
>>  /dev/xvda1                                           227328                    16777182                    16549855                     7.9G Linux filesystem                    
    /dev/xvda14                                            2048                       10239                        8192                       4M BIOS boot
    /dev/xvda15                                           10240                      227327                      217088                     106M EFI System
    Free space                                         16777216                    20971486                     4194271                       2G

but even after resize and write, my partition size is not getting modified. I am not using LVM in my system.

please see the output of parted -l command,

Model: Xen Virtual Block Device (xvd)
Disk /dev/xvda: 10.7GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system  Name  Flags
14      1049kB  5243kB  4194kB                     bios_grub
15      5243kB  116MB   111MB   fat32              boot, esp
 1      116MB   8590MB  8474MB  ext4

Does anyone know how i can modify the size of the root partition here?

muru avatar
us flag
Add the output of `parted -l` or `cfdisk -l` to the post please. You can only resize to free space immediately after the partition, but I'd expect increasing the size of an EBS volume to add free space at the end of the disk, so after the `xvda15` volume if it is indeed the last partition.
Alakananda S avatar
cw flag
Added the output of parted -l command in the question
waltinator avatar
it flag
One can only change partitions if all partitions on the disk are UNmounted. Normally, I would suggest booting into "Try Ubuntu" mode from your install medium, but that seems impractical on. AWS. Back up your User data, back up your system (everything) and reinstall.
Alakananda S avatar
cw flag
i just freed up some space and ran growpart command, and i was able to successfully extend the partition size. Later i ran resize2fs command and extended the file system size too. but i still dont understand why i was not able to change the partition size using cfdisk
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.