1

I think my hard disk contains bad sectors and those bad sectors locate on the place where VM instance is, is there a tool that will allow me to fix those errors, or at least shift all the bad sectors from crucial point to the no so crucial place, so that I can do still boot up my VM machine?

Edit: One thing I am concerned is,since a VM file is typically very big, (a few GBs), that if a bad sector is located on a VM file ( no matter how small the bad sector is) , then the VM file is as good as dead? Is there anyway to save that poor VM instance?

Graviton
  • 5,900

5 Answers5

2

SpinRite might be able to help you out.

raven
  • 5,435
0

Run chkdsk c: /f /r

This will fix the filesystem, check for bad sectors and mark them as bad so that they are no longer used.

If these happen to be within the VM file then it will be corrupt. You may be able to fix the corruption by running the same command inside the VM. Otherwise you will need to recreate it/restore from backup.

If the VM no longer boots you may be able to attach the drive to another one that does boot and run chkdsk or some other recovery tools on it.

JamesRyan
  • 1,681
0

If the bad sectors correspond to unallocated sectors in your VM's virtual disk, you may be able to use a disk imaging program (e.g. Ghost, etc.) to clone the virtual disk into a second virtual disk. Locate the second virtual disk on a separate hard drive, so that you can replace the original drive.

A slightly more risky approach: "shrinking" the virtual disk and then making a "full clone" from within the VM software may have the same effect.

bk1e
  • 1,609
0

First, why would you want to entrust your VM to a disk that has developed bad sectors? Even if you could recover the bad sectors (I have heard of programs that supposedly do this), would you really feel confident they wouldn't go bad again - soon? New hard drvies are dirt cheap. 1TB for $80. Maybe less. Go get a new hard drive and use something that hasn't proven suspect. That said, if this is critical, why are you not using RAID? A RAID 1 mirror would help ensure you don't lose anything - and it costs an extra $80 (for that 1 TB drive and MAYBE an extra $50 for a controller, if your motherboard doesn't support it).

0

You should probably assume the virtual hard disk is corrupt, and should not implicitly trust any data from it, even if you can make it bootable or recover your files.

Your best bet is to create a new virtual machine and restore your data from backups, assuming you were a good sysadmin. :)

If you don't have a known good backup, I'd suggest using dd_rescue to image the entire hard disk to at least one more hard drive, then trying some of the other recovery methods (such as chkdsk /r on the host machine). Once the virtual disk file can be copied, you can try to boot the copy and recover files. If it's not bootable, you can try attaching the virtual disk file to a different VM to recover your files. Again, you should treat any recovered files as possibly corrupt, and should verify any recovered data before putting it back into production.

There are two lessons to be learned here: First, you should always try to store your virtual machines on a RAID1 at the very least, or ZFS if you want to protect against silent data corruption. And, of course, make frequent backups.

rob
  • 14,388