I have a CentOS Linux VM running in VirtualBox. I wrote a bash script to do some automated tasks. But I accidentally deleted all root folders because I put a line in the script
rm -r $my_dir/*
$my_dir is not found so the above will execute as
rm -r /*. So now all my root folder contents are gone! When I restart my VM, it goes to grub terminal and can't launch the GNOME and bash shell because everything under
/ was accidentally deleted due to the above fault (lesson learned). So is there anyway to safely recover and restore the system either from in the VirtualBox or outside?