1 Go to ESXi dashboard, expand the hard disk to expected size. Here I will resize my disk from 203G
to 1100G
.
2 show current disk capacity
➜ ~ df -h
Filesystem Size Used Avail Use% Mounted on
...
/dev/sda1 203G 161G 32G 84% /
...
3 use parted
to show and resize disk. You may need to install parted
if it was not installed.
➜ ~ sudo parted
GNU Parted 3.5
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Model: VMware Virtual disk (scsi)
Disk /dev/sda: 1100GB <------------- LOOK HERE
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:
Number Start End Size Type File system Flags
1 1049kB 222GB 222GB primary ext4 boot
2 222GB 223GB 1022MB extended
5 222GB 223GB 1022MB logical linux-swap(v1) swap
(parted) resizepart 1
Warning: Partition /dev/sda1 is being used. Are you sure you want to continue?
Yes/No? Yes
End? [222GB]? 1100GB
Error: Can't have overlapping partitions.
(parted)
Here we can see Disk of /dev/sda is totally: 1100GB
.
And I want to resize part 1 with command resizepart <part number>
. But failed because there are 2
partition after it.
4 Backup your data and remove the following partition.
# delete swap partition
sudo swapoff -a
sudo parted /dev/sda rm 5
# delete the extended partition
sudo parted /dev/sda rm 2
5 Resize
# Resize /dev/sda1
sudo parted /dev/sda resizepart 1 1100GB
# Resize the Filesystem
sudo resize2fs /dev/sda1
6 Then you can see:
➜ ~ df -h
Filesystem Size Used Avail Use% Mounted on
...
/dev/sda1 1007G 194G 771G 21% /
...