<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="4.4.1">Jekyll</generator><link href="https://blog.pavementlink.ch/feed.xml" rel="self" type="application/atom+xml" /><link href="https://blog.pavementlink.ch/" rel="alternate" type="text/html" /><updated>2026-05-19T21:10:51+00:00</updated><id>https://blog.pavementlink.ch/feed.xml</id><title type="html">Richard’s Blog</title><subtitle>Thoughts on tech, software engineering and cybersecurity by Richard Tenorio &amp; more.</subtitle><entry><title type="html">My first corrupted hard drive problem</title><link href="https://blog.pavementlink.ch/2026/05/07/my-first-corrupted-hard-drive-problem/" rel="alternate" type="text/html" title="My first corrupted hard drive problem" /><published>2026-05-07T00:00:00+00:00</published><updated>2026-05-07T00:00:00+00:00</updated><id>https://blog.pavementlink.ch/2026/05/07/my-first-corrupted-hard-drive-problem</id><content type="html" xml:base="https://blog.pavementlink.ch/2026/05/07/my-first-corrupted-hard-drive-problem/"><![CDATA[<h1 id="whoami">whoami</h1>

<p>I’m a ICT engineer and have been working for 4 years at a nice small biopharma company in Switzerland with lots of really smart people, and most importantly, an awesome IT team :). I’m passionate about software engineering and cybersecurity.</p>

<h1 id="the-problem">The problem</h1>

<p>At the end of 2023, our backup system detected that there was an issue with one of our servers. The result of that was that the backup couldn’t be completed. The role of that server was to host a MS SQL Database that retrieves and stores data from desktop clients across our labs that are used to control complicated instruments which run complex analyses that are not relevant for us cool kids. An important thing to note here also is that this server has a short downtime acceptance, because if the desktop client cannot send the results to the database server after a run, all the data is lost (maybe a bad software design, I don’t know…) and because we are talking about cells and biology stuff, each run counts.</p>

<p>After opening the EventViewer in Windows, those were the errors</p>

<p><img src="/assets/my_first_corrupted_hard_drive_exp/eventviewer_error.jpg" alt="eventviewer error" /></p>

<p>As a quick fix, we started using MS SQL backup system to dump the database (don’t judge, sometimes there’s just too many things to do), it worked for while but after a while, a user told the team that some analyses were not accessible anymore.</p>

<p><img src="https://media.giphy.com/media/v1.Y2lkPTc5MGI3NjExeWlzOTdzYWwwdzBkZWR0NHY0dTNna29nbzFpbDd1c3FxN3Bra3BkMyZlcD12MV9naWZzX3NlYXJjaCZjdD1n/28UMYUOhdbOzAVtKiK/giphy.gif" alt="" /></p>

<p>So hard drive has a bad block, pretty scary, but to fix things, it is often useful to know what broke it.</p>

<h2 id="investigation">Investigation</h2>

<h3 id="lead-1---edr-its-always-the-av-fault-right-">Lead 1 - EDR (it’s always the AV fault right ?)</h3>

<p>Because we had just finished the configuration and the deployment of our new <a href="https://en.wikipedia.org/wiki/Endpoint_detection_and_response">Endpoint Detection and Response</a> (EDR) system a week before. I jumped to the conclusion that the problem was probably due to the EDR agent analyzing / disturbing too much the backup process when the agent tried to make a it. So the pretty straightforward thing to do was to disable the agent and try to do backup, right? guess what, it didn’t work! Then I thought ok, uninstall completely the EDR agent, also didn’t work. At that moment, I realized I was up for a ride.</p>

<h3 id="lead-2---vss">Lead 2 - VSS</h3>

<p>After deep diving into a ton of error codes and logs, I identified that the problem was coming from a <a href="https://learn.microsoft.com/en-us/windows-server/storage/file-server/volume-shadow-copy-service">Volume Shadow Copy Service</a> (VSS) provider not being able to read a snapshot. and oh boy! Every red flag should have started waving as soon as I read “not being able to read”.</p>

<p>So for those who aren’t familiar with VSS, it’s basically Windows offering you to manage exactly how a snapshot of disk volume that you want to backup is done. Here is Microsoft’s diagram that shows the architecture.</p>

<p><img src="/assets/my_first_corrupted_hard_drive_exp/vss_diagram.jpg" alt="VSS Diagram" /></p>

<p>My conclusion then was that one of the “backup” volumes couldn’t be read by our backup software which is <a href="https://www.synology.com/en-global/dsm/feature/active-backup-business/pc">Active Business backup</a> from synology.</p>

<p>So I thought, maybe it is just the backup that is corrupted. I should stop the backup service, delete the VSS volume copy and try again to backup, but this didn’t work either.</p>

<h3 id="lead-3---please-windows-save-me-for-once">Lead 3 - Please Windows save me for once</h3>

<p>By this point, the backup software was innocent, the VSS configuration was clean, and yet snapshots still wouldn’t work. VSS relies on a bunch of Windows components under the hood, so my next thought was: what if Windows itself is the problem? Maybe one of the system files VSS depends on was corrupted, and that’s why nothing I did at the application layer made a difference.</p>

<p>From my past experiences, when you suspect something is wrong with Windows you run this command and it will try to repair it</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>dism /Online /Cleanup-Image /RestoreHealth
</code></pre></div></div>

<p>You can also run the command below to scan for corrupted files</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>sfc /scannow
</code></pre></div></div>

<p>Ok so we tried, it detected indeed that something was wrong but couldn’t repair it.</p>

<h3 id="lead-4---the-shady-sql-patch">Lead 4 - The shady SQL Patch</h3>

<p>I then took a step back to enumerate what changed in this server the last months. That’s when I remembered that a technician came for a maintenance and ran a SQL script to “Patch” the database for a new version of their client application.</p>

<p>Cross-referencing dates, the patch lined up suspiciously well with when the issues started. My theory at the time was that calls colliding with the <code class="language-plaintext highlighter-rouge">DROP</code>/<code class="language-plaintext highlighter-rouge">CREATE</code> had somehow triggered the corruption. In hindsight, that’s not really how SQL Server corrupts pages, T-SQL can’t write bad sectors directly. But the timing was real. The patch was probably heavy I/O on audit pages that hadn’t been touched in a long time, and that’s what exposed sectors whose magnetic signal had already weakened. The disk was dying. The patch just made it impossible to ignore.</p>

<h1 id="resolution">Resolution</h1>

<p>Now that we established what caused the issue we knew that we would need to run an offline tool to try to repair the corrupted page in the disk.</p>

<p>We also thought that it would be a good idea to replace this disk. So we contacted the hardware vendor for this server, which is Dell, explain the situation and they said : “ok cool, we can send you a new hard drive but we cannot help more :)”, even though the server was still under warranty. I wasn’t expecting that, but oh well.</p>

<p>The idea was then to try to repair the bad sectors that the database broke while writing the page and then move everything to the new disk.</p>

<p>That was also the time where I lost all hope in recovering any data from this disk.</p>

<p>We tried anyway a few software and even paid for those below.</p>

<h3 id="easeus">EaseUS</h3>

<p>The famous <a href="https://www.easeus.com/">EaseUS</a>, Even the paid version couldn’t repair them. We bought it so you don’t have to :).</p>

<h3 id="hdd-regenerator-dmitriy-primochenko">HDD Regenerator (Dmitriy Primochenko)</h3>

<p>After searching for a while, we came across <a href="https://www.dposoft.net">HDD Regenerator</a>, which claims it can recover data from bad sectors on magnetic disks using a special algorithm. We gave it a try, even though the website looks like a huge scam, because we had nothing left to lose. And it worked.</p>

<p>I couldn’t understand how. Bad sectors are either physically damaged or contain data that no longer reads back correctly. How can software repair a hardware issue? It felt like “downloading more RAM.”
After some more research, I found that others had the same question, and the consensus was this: the software doesn’t physically repair the platter. What it actually does is repeatedly read and rewrite the sector with specific magnetic patterns. Many “bad” sectors aren’t physically destroyed, they’re weakly magnetized, meaning the signal has decayed to the point where the drive’s error correction can no longer recover the data reliably. Rewriting the sector with a strong, clean signal can restore it to a readable state. If the sector is truly physically damaged, the drive’s firmware will eventually remap it to a spare sector from its reserve pool, and the OS sees a healthy sector again.</p>

<p>So how were we able to recover the database and the data inside it? Most of the data was probably still intact, only a few sectors were unreadable. Once those were either restored (rewritten with a strong signal) or remapped by the drive’s firmware, the filesystem and the database engine could read the file end-to-end again. SQL Server pages also have checksums, so if any page came back wrong rather than unreadable, we’d have known. We got lucky: the corruption was at the magnetic-signal level, not at the “platter is scratched” level.</p>

<h1 id="conclusion">Conclusion</h1>

<p>This disk was probably dying. <del>I did some research, and a RAID wouldn’t have saved it either, RAID protects against drive failure, not against silent page corruption that gets faithfully replicated to every mirror.</del> &lt;– (discused in my first update <a href="#update---1-2026-05-09">here</a>) The SQL patch was likely heavy in I/O operations on audit pages that hadn’t been touched in a long time, and that’s what surfaced sectors whose magnetic signal had quietly decayed.</p>

<p>What did I learn? A few things:</p>

<ul>
  <li>Backups are not enough. You need to know your backups actually restore, and you need to verify the data they restore is good. We were lucky.</li>
  <li>When a vendor technician runs a “small patch” on a production database, treat it as a real change: backup before, monitor during, verify after.</li>
  <li>Dell’s enterprise support will happily ship you a new drive and wish you good luck. Data recovery is on you.</li>
  <li>And finally: stay curious. Half of fixing this was being willing to keep digging when every lead turned into a dead end, and being open to a sketchy-looking $90 tool that turned out to actually work.</li>
</ul>

<p>Side note: we had to take out the disk from the server and connect it to another computer with another OS running, because it had special SATA interface below is a picture of the cooling setup while it was recovering the bad sectors.</p>

<p><img src="/assets/my_first_corrupted_hard_drive_exp/disk_new_cooling_tech.jpg" alt="new cooling tech" /></p>

<h1 id="update---1-2026-05-09">Update - 1 (2026-05-09)</h1>

<p>After publishing this article on HN : <a href="https://news.ycombinator.com/item?id=48067686">https://new.ycombinator.com/item?id=48067686</a>, there were a few comments worth dicussing here.</p>

<ol>
  <li>
    <p>People were not happy with the fact that I said that a RAID wouldn’t have saved the situation, they said that if this server was using <a href="https://en.wikipedia.org/wiki/ZFS">Zettabyte File System</a> (ZFS) and <a href="https://en.wikipedia.org/wiki/ECC_memory">Error correction code memory</a> (ECC), the server would be protected against this kind of situation -&gt; silent page corruption that gets faithfully replicated to every mirror. I did hear about ZFS in the past but I am no guru on the subject. I then read <a href="https://klarasystems.com/articles/understanding-zfs-scrubs-and-data-integrity/">this</a> article and a few others and it confirms that ZFS would have helped a lot against the issue we had here.</p>

    <p>The downside that I saw with ZFS is that it’s very not recommended for Windows Server in Production, there is a project called <a href="https://openzfs.org/wiki/Main_Page">Open-ZFS</a> which is having good results but it is still not recommended. Windows Server is mandatory in this case because of the vendor’s specifications and algonside the database, there’s a instrument server sevice running which controls the lab instruments and this s a Windows binary.</p>
  </li>
  <li>Not enough monitoring : This is just simple truth, we monitor if services are up but that’s about it, we are not enough granular and should have more monitoring !</li>
  <li>Me using AI : This is just stupid, using AI for anything in 2026 shouldn’t be a debate anymore. The only wrong correlation here is thinking that if you use AI you don’t learn. But that’s a subject for another time.</li>
  <li>What to keep in mind : People in the comments were talking like everything is AAA company with unlimited resources, that’s not the case here and context is everything.</li>
</ol>

<p>Nonetheless, I learned a lot from sharing this on HN, and I was glad to see that it interested people from all over the world.</p>]]></content><author><name></name></author><category term="hardware" /><category term="troubleshooting" /><category term="sql" /><category term="windows" /><summary type="html"><![CDATA[whoami]]></summary></entry><entry><title type="html">Hello, World</title><link href="https://blog.pavementlink.ch/2026/05/06/hello-world/" rel="alternate" type="text/html" title="Hello, World" /><published>2026-05-06T00:00:00+00:00</published><updated>2026-05-06T00:00:00+00:00</updated><id>https://blog.pavementlink.ch/2026/05/06/hello-world</id><content type="html" xml:base="https://blog.pavementlink.ch/2026/05/06/hello-world/"><![CDATA[<p>After years of building things and meaning to write them up, I’m finally doing it.</p>

<p>This blog is where I’ll document things I find interesting: infrastructure experiments, notes on tools and techniques I keep reaching for. No particular schedule, no particular audience in mind, mostly a personal log that might be useful to someone else.</p>

<h2 id="what-to-expect">What to expect</h2>

<ul>
  <li><strong>Short takes</strong> : observations and weird takes that I might have.</li>
  <li><strong>Engineering notes</strong> : setup guides, debugging sessions, architecture decisions worth capturing.</li>
  <li><strong>CTF writeups</strong> : post-competition analysis of challenges I found interesting or frustrating.</li>
</ul>]]></content><author><name></name></author><category term="introduction" /><summary type="html"><![CDATA[After years of building things and meaning to write them up, I’m finally doing it.]]></summary></entry></feed>