LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   General (https://www.linuxquestions.org/questions/general-10/)
-   -   How to convert a Windows Dynamic Disk (MBR) to Standard (https://www.linuxquestions.org/questions/general-10/how-to-convert-a-windows-dynamic-disk-mbr-to-standard-4175676605/)

LBuhler 06-06-2020 07:19 AM

How to convert a Windows Dynamic Disk (MBR) to Standard
 
To keep in line with the privacy regulations imposed by the EU I needed to encrypt my business servers containing customer data. Having installed a new Linux server recently with proper encryption and Raid 1 array I couldn't leave my sole Windows Server 2012-R2 lagging behind.

One's got to love Linux's dynamic and modular possibilities when it comes to encryption and disk manipulation. This will become clear in the following sections.

The first obstacles showed up quickly. Windows Server 2012 R2 has bitlocker capabilities, but not for a software Raid 1 setup. Which is what's in place and the Raid 1 is a necessity for my server.

This meant that I had to migrate this setup to hardware Raid 1. Getting a Raid controller is easy, however, transferring everything to the newly found array is harder.

If you retain the same drives, they have to get erased and a little bit of hard drive space is lost to facilitate the Raid controller. Due to this fact you cannot use the windows backup system to restore the system. It could be possible with a larger drive, but count on the Windows backup system blocking the recovery because the drives don't match their original counterparts.

So onto Linux it is, either with a Live medium or a installation on an USB drive. Have a big enough spare drive available to transfer the original drive onto or use two other disks to create the new hardware Raid array.

I used the original drive as the source and copied the data to the new array with SSDs having the same size as the original. The next part is an explanation in case you use another drive to move the data to (and function as a proxy).

You can just run (everything as root):
dd if=/dev/<source disk> of=/dev/<temp dest disk>
This will give you a complete duplicate of the original drive somewhere else. After this, reboot, assemble the array and reboot Linux.

The source drive contains (usually) 4 partitions (in a msdos/mbr setting). These are all of the type "SFS" which indicates the presence of and them being a part of a proprietary Microsoft dynamic drive. You can't resize these or alter these partitions because parted can't handle their proprietary structure.

What you can do is copy them the new array. Start gparted to get going:
gparted
Create a new partition table type "dos" on the new array disk. Let's keep that at /dev/sdb for this example. Adjust these devices according to your setup.

On the source disk (/dev/sda for instance) the first and last small partitions are to be forgotten on the source drive. Copy the recovery/boot partition to the new drive.

Right click on the source partition (sda2 i.e.) and select "copy". Select the destination drive (sdb), right click on the unpartitioned/unallocated space and select "paste". If the other partition is bigger, shrink this partition first by selecting "resize/move" to have enough available space for the other partition(s).
Head back to the source drive and copy the other partition(s). Paste it into the free space of the destination drive. Hit the apply button to start this process of copying. This may take a while.
Once everything has been transferred, resize the partitions to make everything line-up again. Don't forget to hit apply. In my case the boot/recovery partition had to become 350 MiB again. If you have a boot partition present, right click on that one, "manage flags" and activate "boot".

You can exit gparted now. If this drive contains your Windows system, the following is essential to restore it to a bootable state:
dd if=/dev/sda of=/dev/sdb bs=446 count=1
This copies the bootsector (but not the partition table) to the destination drive.

If you're not using a live Linux distribution you may consider updating your grub using:
"update-grub" or "grub-mkconfig -o /boot/grub/grub.cfg"
This should give you the option to boot the Windows recovery drive.

This, or your original Windows install medium, should be used for the final part of this transfer. Boot into the recovery mode from the grub bootloader (hit F12 and subsequently F8 and make sure you end up at a command prompt). If you use the install medium, boot it and select recover instead of running the install. Drop to the command prompt.

You should be at "X:\sources" move to recovery:
cd recovery
Run:
StartRep.exe
This should be enough to restore the drive's booting capabilities.

That's it, you've successfully converted your dynamic Windows (software Raid 1 array) disk to a (hardware Raid array) standard layout disk.

If you are going to do this with a GPT/(U)EFI drive examine the differences carefully first. This guide is not sufficient to make such a transfer successful.

OliverYY 06-23-2020 12:26 AM

LBuhler

I have a problem and hope you or someone can help me.

We were changing a secundary (NTFS, not bootable) disk to another machine and it appeared in the winxp64 disk management as dynamic and foreign.

I dont remenber why and when it became dynamic but anyway is was a simple and single volume in just one partition nad logical drive.

in the context menu, Inadvertdly i click in the "convert to basic disk" instead of "import foreign disk" and the result is "F***" I hope i can anyway retrieve my data!! it became basic and with unallocated space, no partition.
Then, we change the disk to other 2 diferent machines, in one it apeared as offline, in other apeared as basic with the space unallocated, we tried to convert it back to dynamic but no success, unalocated again.
We dont want to create a logical drive because we are afraid of doing more things on it.
Do you think we can find any way with any disk editor or partition recovery/rebuil tool that can make possible to recovery our files in there?
We tried already with the Linux Rescue CD and it cannot see files.

Can you help?
Thank you

LBuhler 06-24-2020 02:38 AM

Quote:

Originally Posted by OliverYY (Post 6137149)

in the context menu, Inadvertdly i click in the "convert to basic disk" instead of "import foreign disk" and the result is "F***"
Can you help?
Thank you

Oh boy, you converted it, ouch...

See if you can back the whole disk up the way it is now (make sure to have enough space available):
dd if=/dev/<source> of=Fubared-disk.img
This way you can always dd it back to the drive for another recovery attempt.

Install "gparted" and "gpart" and start up gparted.

Click on Device (top bar)/Attempt data rescue. Do make sure that ntfs-3g or a similar package is installed on the Linux machine. If there wasn't a slow format executed you might be able to recover some data with this. Otherwise, there are programs out there that might get you some data back. I don't know about those, but if you made that backup img, you could just give it a shot anyway.

Hope this helps, best of luck and if you get some good results, let me know!

Laurens


All times are GMT -5. The time now is 09:20 AM.