Home » Programming Languages » Query Languages

Handling SQL Server Database Corruption When Your File System Fails

Young sad confused software engineer IT programmer man in shirt work at home writing code on laptop pc computer spread hands shrugging shoulders look puzzled have no idea Program development concept.
Sad Databases

We have designed a lab environment to do some tests on some devices. One of the devices that we had tested was a WD My Book World Edition 1TB (White Light). When we plugged in the power cord, it sounded like it started up fine however, the web interface was not accessible and there was no network activity at all. We had opened up the case to check if any cable might be loose or something but everything seemed okay. I connected it back together and tried again with the same result.

The third time plugging it in, the power light came on for about two seconds before dying off completely. I didn’t think much of this because sometimes these network storage devices act strange when they are first connected directly to a computer or after being shut down improperly. After letting it sit for a few hours, I plugged it back in and saw the power light blink on and off again after about 2 seconds. I decided to leave it there for another half hour or so before plugging it back into my computer, says Jonah Engler.

 As soon as I plugged it into a USB port to my computer, the Windows machine failed to boot up properly with error messages like this:

We ran chkdsk /f against disk 1 (drive 0) using a command prompt but that failed because the file system was already corrupted. The file system structure was totally messed up, something like this:

Notice how all of these folders are empty except for one folder called “files”. We tried copying some files over but they were corrupted too. We were not able to copy over any of the data (about 1Tb worth) from this device because it was no longer recognized by the OS. Copying files using Linux over SMB didn’t work either, resulting in file corruption or other errors like “access denied”. The network drive did power up and worked normally after powering on/off a few times so perhaps it’s something related to the way Windows treated USB devices when plugged directly before? I thought at first that maybe there was some firmware problem causing this issue because everything else seemed okay including the RAID array which consisted of 2 500Gb SATA hard drives running just fine. Just for fun I tried plugging this device into my Debian Linux laptop again but encountered the same file system errors and errors when trying to copy over files and folders. I tried plugging it into my FreeBSD 7.1 box and had no problems whatsoever, the web interface was accessible and everything copied over just fine! We then attempted to plug this device into our Linux router but we encountered file system errors again so this seemed like a problem with the Windows machine only.

I Googled around for a while and found some other people who were having similar issues:

Most of these posts suggested running chkdsk /f/r on the faulty disks so we tried that using the Windows recovery console but it failed halfway through because the disk was unreadable. We decided to simply reformat the disk and do a fresh install of Windows XP Professional which also failed midway through because the partition table was corrupted. I finally ran Acronis Disk Director Suite 10’s full disk copy utility against this drive to back up everything first. Just for fun, after copying all of the data off, I tried doing another full format against the drive but encountered file system errors again at beginning of the formatting process. One thing different though, this time I got an error message saying “Windows cannot find .\bootmgr”. If you’re not familiar with that, it’s the Windows version of grub.exe so I thought maybe this drive encountered some kind of problems booting up. The problem started happening on all USB devices plugged into the same machine so we figured it might be something related to how Windows was handling them when booted up but we weren’t too sure about it.

We decided to order a replacement disk and do an image restore from Acronis Backup 10. When we tried restoring everything back onto the new 500 GB SATA hard drive, we got file system errors again! The same thing happened when trying to format the newly installed hard drive: “Windows cannot find .\bootmgr”. Hmmm.. We’re scratching our heads now because this whole time the storage device worked fine under *nix OSs but had problems in Windows. We tried installing Windows XP Professional onto this drive again but midway through the installation process, we encountered file system errors again! At this point, I was thinking that perhaps it’s just bad luck and somehow all of our backups were corrupted when trying to restore them back into new drives.

After much troubleshooting using different tools like chkdsk /r , Diskpart, Acronis Disk Director Suite 10, Partition Wizard 5.0, DBAN , HDDScan 3.30, Spinrite 6 , BartsPE CD , etc., we finally discovered a solution to get the device working again! There’s one more tool that wasn’t mentioned by many people online and ended up working for us.

Conclusion:

The vast majority of us rely on Windows boxes to do our jobs. Sometimes you get into situations where you pretty much have no choice but to use Windows for whatever reason, perhaps because of work-related applications that are not cross-platform. No matter how hard we try to avoid using it, sometimes inevitable happens. We all can agree that there are times when random things go wrong with our PCs which make some tasks extremely difficult or even impossible to perform without cracking open a bottle of wine.