You finally decided to try Linux in a virtual machine. You chose and downloaded a Linux distribution that looked good, created a virtual machine, installed it, played with it, ended up loving it. And now you want to see more of this fascinating Linux Land but can’t because your virtual HDD is full.
Instead of trying to alter the virtual machine’s HDD, we’ll do what we’d do with a “normal” PC: create and “attach” a second HDD, then use a standard, bootable version of the favourite imaging/backup tool CloneZilla to copy the contents of the old virtual HDD to the new one and then remove the old HDD, leaving you with more storage without having to deal with cryptic commands and strange failures. There is no need to back up things since your old virtual HDD will still exist if need be. As a bonus, the latest versions of CloneZilla deal with the resizing of any partitions, so if everything goes according to plan, after this you only have to swap virtual HDDs and boot your virtual PC.
See how to do it at https://www.maketecheasier.com/increase-virtualbox-hdd-size-clonezilla/
One common error in Virtualbox is the lack of hard drive space in the virtual machine. Here's how to increase Virtualbox hard drive space with Clonezilla.