Symptom:
When attempting to install a new package using apt, an error message regarding unmet dependencies is displayed and suggests using apt-get -f install to fix the problem.
However, sudo apt-get -f install throws an error about no disk space.
Cause:
Updates have failed due to low disk space and resulted in dependency problems.
Solution:
Increase the size of the virtual machine’s disk
Troubleshooting Steps:
- sudo apt-get -f install throws an error about no disk space.
- df shows that the root file system is at or near 100%
- sudo apt-get clean clears some space, but not enough for apt-get -f install to fix the dependency problem.
- The best long term solution is to increase the size of the Virtual Machine’s disk (.vdi file). However a .vdi in fixed format cannot be resized. It must first be cloned to a dynamic (default) disk.
- Check to see what format the .vdi file is in
- vboxmanage showhdinfo /path/to/servername.vdi
- Format variant: fixed default
- Clone the .vdi file to create a copy that is in dynamic (resizable) format
- vboxmanage clonehd /path/to/servername.vdi /path/to/newserver.vdi
- Verify that the disk is now in dynamic format
- vboxmanage showhdinfo /path/to/newserver.vdi
- Format variant: dynamic default
- Increase the size of the disk (For example, from ~5GB to ~20GB)
- vboxmanage modifymedium /path/to/newserver.vdi –resize 20000
- Launch the virtual machine from a live Linux .iso and use GParted (or your favorite disk management application) to expand the disk
- Deactivate the main Ubuntu volume so that it can be modified. Right-click on it and select deactivate.
- Right-click on the parent extended partion and choose Resize/Move
- Click and drag the black arrow to the far right to use up the new space
- Select Edit -> Apply all operations
- Right-click on the main volume and select Resize/Move
- Repeat steps three and four
- Shutdown the VM, remove the live Linux .iso, and restart with the vdi
- Issue the command df and note how the root file system is still at its original size
- Launch a root shell
- sudo su
- List the physical volumes
- pvs
- Note the PSize shows the actual available space
- List the logical volumes
- lvdisplay
- Note the logical volume path as it is required for the next couple of steps
- Extend it to take the full size available
- lvextend -l+100%FREE /dev/UbuntuServer64-1-vg/root
- Extend the file system on the whole logical volume
- resize2fs /dev/UbuntuServer64-1-vg/root
- Issue df
- The root file system should now have the new free space
References
https://blog.vbonhomme.fr/extend-a-lvm-partition-after-increasing-its-virtual-disk-on-virtualbox/
Pingback: Drupal Installation | bhm.world
Pingback: Drupal Installation |