- Backup image first
- Change to root permission
# sudo -i
3. Check available disk
From information below, the available disk is 80 GB but the current partition is 1.4 G
# fdisk -l /dev/vda
Disk /dev/vda: 80 GiB, 85899345920 bytes, 167772160 sectors
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: 0x4c08a4cd
Device Boot Start End Sectors Size Id Type
/dev/vda1 * 2048 2866431 2864384 1.4G 83 Linux
4. Delete partition
Follow instruction below.
# fdisk /dev/vda
Welcome to fdisk (util-linux 2.32.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): d
Selected partition 1
Partition 1 has been deleted.
Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): [Enter]
First sector (2048-167772159, default 2048): [Enter]
Last sector, +sectors or +size{K,M,G,T,P} (2048-167772159, default 167772159): [Enter]
Created a new partition 1 of type ‘Linux’ and of size 80 GiB.
Partition #1 contains a ext4 signature.
Do you want to remove the signature? [Y]es/[N]o: n
Command (m for help): w
The partition table has been altered.
Syncing disks.
5. Resize the partition
# resize2fs /dev/vda1
resize2fs 1.45.4 (23-Sep-2019)
Filesystem at /dev/vda1 is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 10
The filesystem on /dev/vda1 is now 20971264 (4k) blocks long.
6. Check disk available,
# fdisk -l /dev/vda
Disk /dev/vda: 80 GiB, 85899345920 bytes, 167772160 sectors
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: 0x4c08a4cd
Device Boot Start End Sectors Size Id Type
/dev/vda1 2048 167772159 167770112 80G 83 Linux