110Volumes - amagerard/TemplateVM GitHub Wiki
Home
RedHat10/TemplateVM.
| 1- Installation | 2- Network | 3- Firewall | 4- Selinux |
|---|---|---|---|
| 5- Logs | 6- Certificates | 7- PassphraseSSH | 8- Sudo |
| 9- GnomeShell | 10- Volumes | 11- Proxmox | 12- Troubleshoots |
10. Logical volume.
10.1 Increase the size of the var volume.
vgdisplay displays the available space on the logical volume group.
vgdisplay
Alloc PE / Size 5632 / 22,00 GiB
Free PE / Size 3302 / <12,90 GiB
You have 12,90 G available for logical volumes.
Example:
/dev/vgl0/var needs +4G.
lvextend -L+4G /dev/vgl0/var
resize2fs /dev/vgl0/var
df -h
/dev/mapper/vgl0-var 7,8G 166M 7,3G 3% /var
Refreshing the free space of the logical volume group.
vgdisplay
Alloc PE / Size 6656 / 26,00 GiB
Free PE / Size 2278 / <8,90 GiB
You have 8,90 G available for logical volumes.
10.2 Reduce the size of the var volume.
To shrink a volume, you must unmount it.
This is impossible if this volume is in use by the system.
For me, shrinking is possible for :
- /var
- /var/log
- /usr/local
- /home
- /opt
For the root /, you must boot the VM from "live AlmaLinux".
Example:
/dev/vgl0/var reduce 4G.
If you have installed gnome-shell.
Restart without the graphical interface.
systemctl set-default multi-user.target.
Unmount the mount points /var and /var/log.
vi /etc/fstab
Put # before theses lines.
#UUID=d10a8cb2-4d06-482c-90de-b15caa1bba55 /var ext4 defaults 1 2
#UUID=257c5685-02cd-466c-91e0-0d86280914b6 /var/log ext4 defaults 1 2
reboot
Check a Linux ext4 file system.
e2fsck -f /dev/mapper/vgl0-var
resize2fs /dev/mapper/vgl0-var 4G
lvreduce -L 4G /dev/mapper/vgl0-var
vi /etc/fstab
Delete # before theses lines.
UUID=d10a8cb2-4d06-482c-90de-b15caa1bba55 /var ext4 defaults 1 2
UUID=257c5685-02cd-466c-91e0-0d86280914b6 /var/log ext4 defaults 1 2
systemctl daemon-reload
mount /dev/mapper/vgl0-var
mount /dev/mapper/vgl0-varlog
df -h
/dev/mapper/vgl0-var 3,9G 167M 3,6G 5% /var
Refreshing the free space of the logical volume group.
vgdisplay
Alloc PE / Size 5632 / 22,00 GiB
Free PE / Size 3302 / <12,90 GiB
You have 12,90 G available for logical volumes.
If you have installed gnome-shell.
Restart with the graphical interface.
systemctl set-default graphical.target
reboot
Useful command to kill processes on the volume.
fuser -kimuv /var/log
fuser -kimuv /var