<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title><![CDATA[0xpebbles.org]]></title>
    <link><![CDATA[http://blog.0xpebbles.org]]></link>
    <description><![CDATA[0xpebbles blog]]></description>
    <lastBuildDate>Fri, 09 Apr 2021 08:37:24 +0200</lastBuildDate>
    <pubDate>Fri, 09 Apr 2021 08:37:24 +0200</pubDate>
    <language>en</language>

<!-- 20130601 -->    <item>
      <title>DiskCryptor and resizing partitions</title>
      <link>http://blog.0xpebbles.org/DiskCryptor-and-resizing-partitions</link>
      <pubDate>1 Jun 2013 00:00:00 +0000</pubDate>
      <content:encoded><![CDATA[

  

<p>
For the few windows-things I sometimes need, I'm running a multi-boot environment on my laptop, Windows and FreeBSD. Windows' partition is encrypted by <b>DiskCryptor</b>. I recently switched to a SSD drive, and went from a 160GB drive to a 256GB one. <b>dd</b>'ing everything from one drive to the other worked like a charm, at least for FreeBSD. Windows had some hickups at first, but I was able to fix them.
</p>

<p>
Anyways, after the transition I had about an additional 100GB of unused space on the drive. I decided to grow the last partition to fill most of the remaining space (not all).
</p>

<p>
Everything went fine, until a few months later. I moved tons of data to the last (resized) partition and the next time I tried to start my computer the boot just hang at a black screen with a blinking cursor.
</p>

<p>
Hooking up the drive to another machine to be able to check its contents, turns out that the data on the drive was just fine, and that I could mount my encrypted Windows partition using <b>DiskCryptor</b>, without a problem. Comparing the MBR and VBRs with the ones from the old drive didn't show any differences, either. However, the boot sequence was somehow broken.
</p>

<p>
Turns out, that when installing the <b>DiskCryptor</b> bootloader, <b>DiskCryptor</b> moves the original MBR right behind the last partition, then installs its own to the drive which in turn - after authentication - jumps to the copy of the original one.
</p>

<p>
By resizing my last partition, then having tons of data copied to it, I basically overwrote the <i>original MBR</i>'s code eventually, resulting in the boot to fail. The new MBR jumped to..., well..., something.
</p>

<p>
The fix is to "repair" the MBR to what you want it to be (in my case FreeBSD's boot0). A quick restart will verify if the MBR is functional again - this won't allow to boot the encrypted Windows partition, yet, of course.<br>
Then, boot some Windows to have access to <b>DiskCryptor</b> (Hiren's boot CD/USB works like a charm), hook up your hard drive and re-install <b>DiskCryptor</b>'s boot loader to it. Make sure, before you install the boot loader, that your partition table is what you want it to be, as this determines where <b>DiskCryptor</b> will move the original content of the MBR. <b>DiskCryptor</b> will now put your original MBR to where it really needs to be - behind the last partition, and it won't be somewhere in the middle of an existing one. Wish I would have known right after I resized my partition. ;)
</p>

]]></content:encoded>
    </item>




  </channel>
</rss>

