78 lines
2.6 KiB
Markdown
78 lines
2.6 KiB
Markdown
# Resize VM Disk
|
|
|
|
To increase the harddisk of a VM, go to vcenter.psi.ch, select the machine, right click, and select __Edit Settings ...__
|
|
|
|

|
|
|
|
Increase the harddisk size to the value you need to have:
|
|
|
|

|
|
|
|
|
|
Now connect to the system and change to root.
|
|
|
|
List block devices:
|
|
```bash
|
|
[root@awi-ci-01 ~]# lsblk
|
|
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
|
|
sda 8:0 0 42G 0 disk
|
|
├─sda1 8:1 0 600M 0 part /boot/efi
|
|
├─sda2 8:2 0 1G 0 part /boot
|
|
└─sda3 8:3 0 32.4G 0 part
|
|
├─vg_root-lv_root 253:0 0 14G 0 lvm /
|
|
├─vg_root-lv_var_tmp 253:1 0 2G 0 lvm /var/tmp
|
|
├─vg_root-lv_var_log 253:2 0 3G 0 lvm /var/log
|
|
├─vg_root-lv_var 253:3 0 8G 0 lvm /var
|
|
├─vg_root-lv_tmp 253:4 0 2G 0 lvm /tmp
|
|
└─vg_root-lv_home 253:5 0 2G 0 lvm /home
|
|
```
|
|
|
|
The command will probably not show the correct disk size. For this the VM either needs to be rebooted or you can trigger a re-read of the disksize without a reboot with this command (replace `sda` with the correct diskname you resized):
|
|
```
|
|
echo 1 > /sys/block/sda/device/rescan
|
|
```
|
|
|
|
|
|
Extend partition:
|
|
```bash
|
|
[root@awi-ci-01 ~]# parted /dev/sda
|
|
GNU Parted 3.2
|
|
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: 45.1GB
|
|
Sector size (logical/physical): 512B/512B
|
|
Partition Table: gpt
|
|
Disk Flags:
|
|
|
|
Number Start End Size File system Name Flags
|
|
1 1049kB 630MB 629MB fat32 EFI System Partition boot, esp
|
|
2 630MB 1704MB 1074MB ext4
|
|
3 1704MB 36.5GB 34.8GB lvm
|
|
|
|
(parted) resizepart 3
|
|
End? [36.5GB]? -0
|
|
(parted) print
|
|
Model: VMware Virtual disk (scsi)
|
|
Disk /dev/sda: 45.1GB
|
|
Sector size (logical/physical): 512B/512B
|
|
Partition Table: gpt
|
|
Disk Flags:
|
|
|
|
Number Start End Size File system Name Flags
|
|
1 1049kB 630MB 629MB fat32 EFI System Partition boot, esp
|
|
2 630MB 1704MB 1074MB ext4
|
|
3 1704MB 45.1GB 43.4GB lvm
|
|
|
|
(parted) quit
|
|
```
|
|
|
|
Resize physical volume:
|
|
```bash
|
|
[root@awi-ci-01 ~]# pvresize /dev/sda3
|
|
Physical volume "/dev/sda3" changed
|
|
1 physical volume(s) resized or updated / 0 physical volume(s) not resized
|
|
```
|
|
|
|
Now the effective volumes of the machine can be extended as documented [Resize System Volumes](vgroot.md) |