DiskCryptor and resizing partitions

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 DiskCryptor. I recently switched to a SSD drive, and went from a 160GB drive to a 256GB one. dd'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.

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).

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.

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 DiskCryptor, 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.

Turns out, that when installing the DiskCryptor bootloader, DiskCryptor 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.

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

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.
Then, boot some Windows to have access to DiskCryptor (Hiren's boot CD/USB works like a charm), hook up your hard drive and re-install DiskCryptor'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 DiskCryptor will move the original content of the MBR. DiskCryptor 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. ;)