1

I want to expand my disk size, so I did it in the settings of my virtual machine, and not it says 30GB, but when I power on Ubuntu and check in Disks, it still says 20GB, and the 10GB isn't working. How to fix it?

here's a screenshot of it

2

1 Answer 1

0

I will spare no effort to help you.

Just as your second photo shows, the main/primary partition of your VM's disk is Partition 1 and partition files type is FAT; the extended partition of your VM's disk is Partition 2; the logical partition of your VM's disk is Partition 5 and partition file type is ext4; also, your VM's disk still have 11 GB free space.

As I know,

Principle-A: Size(vm_disk) == Size(main partition) + Size(extended partition);

Principle-B: Size(extended partition) == All the Size(logical partition);

Principle-C: Size(logical partition) <= Size(extended partition);

So, if you want to expand your VM's Disk size, you should expand logical partition Partition 5; but you should firstly enlarge your extended partition Partition 2 before you start to resize your logical partition Partition 5.

Just use sudo cfdisk to check the usage of your VM's disk partitions, I guess you output liking below :

Disk /dev/sda: 33 GiB, 38212254720 bytes, 68914560 sectors
Disk model: VBOX HARDDISK
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x49e5gv86

Device     Boot    Start   End   Sectors   Size Id  Type
/dev/sda1  *        487M    1G   1296880   537M  b  W95 FAT32 
/dev/sda2             1G   22G  46325760    21G  5  Extended
/dev/sda5             1G   22G  46325760    21G 83  Linux 
free space           22G   33G              11G

And I think your needed disk partition likes this:

Disk /dev/sda: 33 GiB, 38212254720 bytes, 68914560 sectors
Disk model: VBOX HARDDISK
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x49e5gv86

Device     Boot    Start   End   Sectors   Size Id  Type
/dev/sda1  *        487M    1G   1296880   537M  b  W95 FAT32 
/dev/sda2             1G   22G  66325760    31G  5  Extended
/dev/sda5             1G   32G  66325760    31G 83  Linux 
free space           32G   33G               1G

Also, I do highly recommend you use partition tool cfdisk instead of APP GParted or partition tool parted.

Solution:

1.just log in your VM;

2.use sudo cfdisk to enter the permission of cfdisk on your VM's terminal;

Use up and down direction button to choose the partition, use right and left direction button to choose the operation, use enter button to make sure.

3.choose Resize button to expand the extended partition Partition 2, change default size into 31GB, and push enter, and again type yes, and push enter to ok;

4.choose Resize button to enlarge the logical partition Partition 5, also, change default size into 31GB, and push enter, and again type yes, and push enter to ok;

5.choose Write button to sync the new partition to the Disk, and use Quit button to quit cfdisk;

6.use sudo resize2fs /dev/sda5 on your VM's terminal to set all the file types of logical partition Partition 5 into ext4;

7.Restart or reboot your virtual machine: sudo reboot.

Have fun!!!:)

OVER!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .