I was using VirtualBox on my precedent mac, but the hard disk crashed, so I managed to retrieve some files, especially my .vdi file where I had all the data of my ubuntu host. I am using a new hard disk, but when I try to install ubuntu with my new VB and with my old .vdi file, I alm told that the .vdi file is partially damaged. How can I open my .vdi file and retrieve the files that are not corrupted ?
Most of the time a crash while running a VM with VirtualBox will corrupt the profile, not the VDI.
Try making a fresh profile and add the existing VDI as the disk. You could also try a scandisk or equivalent on the host system if you haven't.
Do the following steps to rescue data:
1- create a new profile with your .vdi to rescue as a harddisk
2- download a linux live CD (like puppy, gparted, xubunu...) and add it as a live-cd image to the new profile
3- start the VM
4- mount the .vdi file (in my case it was sda2) and rescue your files as you like.