2021年1月19日 星期二

Esxi increase hard drive size (Ubuntu none LVM)

1 Install parted if you don't have them using 

CI-Server:~$ sudo apt-get install cloud-guest-utils


2. Turn off swap. we gonna remove it's partition!
CI-Server:~$ sudo swapoff -a
CI-Server:~$ sudo parted
get partitions list with print all:
(parted) print all
Model: Virtio Block Device (virtblk)
Disk /dev/vda: 752GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start   End    Size    Type      File system     Flags
1      1049kB  528GB  528GB   primary   ext4            boot
2      528GB   537GB  8588MB  extended
5      528GB   537GB  8588MB  logical   linux-swap(v1)
remove none root partitions with rm (part-index):

(parted) rm 5
Warning: Partition /dev/vda5 is being used. Are you sure you want to continue?
Yes/No? yes
Error: Partition(s) 5 on /dev/vda have been written, but we have been unable to
inform the kernel of the change, probably because it/they are in use.  As a
result, the old partition(s) will remain in use.  You should reboot now before
making further changes.
Ignore/Cancel? C
(parted) print all
Model: Virtio Block Device (virtblk)
Disk /dev/vda: 752GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start   End    Size    Type      File system  Flags
 1      1049kB  528GB  528GB   primary   ext4         boot
 2      528GB   537GB  8588MB  extended

(parted) rm 2
Error: Partition(s) 5 on /dev/vda have been written, but we have been unable to
inform the kernel of the change, probably because it/they are in use.  As a
result, the old partition(s) will remain in use.  You should reboot now before
making further changes.
Ignore/Cancel? C
(parted) print all
Model: Virtio Block Device (virtblk)
Disk /dev/vda: 752GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start   End    Size   Type     File system  Flags
 1      1049kB  528GB  528GB  primary  ext4         boot
The commands works on ubuntu 16.04 (NONE LVM) and machine is running on a kvm:

sudo growpart /dev/vda 1
sudo resize2fs /dev/vda1  


沒有留言:

 Ubuntu has a mechanism, that is, the installed network card (NIC) will be renamed to another name when the system is booted. Although there...