Having to change a production Environment Virtual Machine while hosting multiple website could be a nightmare especially when you have no space left and websites are on the edge of error.
I got a complaint from one of the webmasters of the websites that her password was not working so I went and changed it from Plesk however, it didn’t actually work.
When connected to the server I realized that there was no space left on the server
Ubuntu 18.04 is the server edition.
On my Hyper-V Host I went and checked if I can resize the VM while it’s on but unfortunately since the machine has Checkpoints. After switching off the machine and removing the Checkpoints I was able to resize the disk to 700GB and start it again.
In this article I will take you through the process or resizing the Linux Machine starting from Hyper-V all the way until your Plesk Server is able to provision this disk space.
To Resize Ubuntu/Linux Server on HyperV
Edit Machine On Hyper-V, If the edit button is greyed out then you’ll need to switch off the VM to be able to expand the physical disk.
After expanding the disk (in my case I expand it to 712GB) since the current disk is 100% full already
After expansion on Hyper-V is successful, I will switch on the VM, then will need to rescan the already connected disk, first identify which disk you want to rescan. (in my case it is sda3)
ls /sys/class/scsi_disk/
In my example, I see a symlink named 2:0:0:0, so we rescan this scsi-disk.
echo ‘1’ > /sys/class/scsi_disk/2\:0\:0\:0/device/rescan
When trying to scan as a normal user or a superuser in normal mode, I get permission denied issue so I will go ahead and turn to Root mode
Scanning is finished
Follow the instructions below in order to expand the machine’s disk and introduce the changes to Plesk.
Run Parted as a super user (Root or sudo su superuser)
Press P to list partitions and then choose the partition you want to expand.
In my case it’s going to be Partition 3
In order to resize the partition 3 I will type
Resizepart 3
And next to that you’ll have to put the value that you need to expand the disk (In my case I will type -0)
-0 value will give it provision the entire disk space from Hyper-V
After doing so, the new value of partition 3 will be updated
Quit
The file system meta information needs to indicate the size of disk, and resize2fs updates this. Thus, after expanding, run resize2fs /dev/sda3.
If resize2fs didn’t work for any reason try pvresize in Root Mode
pvresize /dev/sda3
To write changes to the Logical Volume run the following command
lvextend -l +100%FREE /dev/mapper/ubuntu–vg-ubuntu–lv
It’s recommended to do this in read mode, so I will quit the root and get back to my normal user
Let’s see the Volume Group using VGS command, as you can see it looks like the Volume group has already updated the size.
Now we need to check the Physical Volume. sda3 was upgraded from 268GB to 711 GB
Next we’ll need to check the Logical Volume and see if it is updated
To do this, type sudo lvdisplay
Let’s check if there’s any update on the Logical Volumes by using
sudo df –H
The disk I need to increase is /dev/mapper/ubuntu—vg-ubuntu—lv
Last step:
To do this I will type the command
Sudo resize2fs /dev/mapper/ubuntu—vg-ubuntu—lv
This should take care of the disk expansion
Once this command is successful, It should reflect on the disk size via command df -H
Hope this help someone, If for some reason your Plesk stopped working after this please try to move the tc.log file to another location and then restart mysql/mariadb
sudo mv /var/lib/mysql/tc.log /root/
sudo service mariadb start
Reset and manage your Active Directory users' Passwords Active Directory is one of the most…
Finding Exchange Database hidden mailboxes. Story:Maybe you have been in this situation before, trying to…
If you're using a Proxy server in your firewall or in your network and have…
Story:I got some clients that have reported some of their users being locked out and…
Delegate Permissions This is a code that I have wrote recently to check if an…
Story: I got a request from a client who constantly gets CVs and have to…