How to migrate Windows 2012 RAID 1 array to Linux?
Solution 1:
As pointed out, you could install Windows and make use of the trial period to retrieve your files, though if you plan to use Linux anyway, then this isn't necessary.
I have just installed Windows 2012 R2 on a VM to play out these steps and follow along... presuming that your mirror was created with Dynamic Disks rather than Storage Spaces.
I created a mirrored volume on two dynamic disks and placed some files on the volume. A quick search indicated that it would be possible to mount such a volume with ldmtool
- but luckily it "just works" with Ubuntu 18.04 (NOTE: without ldmtool
, and without functioning mirroring, but you can access your data).
My recommendations:
Install Linux
Which is the most appropriate Linux OS?
I'd recommend that new Linux users use Ubuntu - it's very well supported, and has a large community... if you run into issues then you most likely will find a solution fairly quickly. As an "expert" user, I primarily use Ubuntu too - I recommend it for most situations.
Ubuntu can be download from here - go for 18.04 as this is an LTS (Long Term Support) release.
Be careful not to alter the data you are trying to relocate - if you're uneasy, then disconnect the data drives from the system while installing Ubuntu.
Decide what Storage to Use
Which RAID software should I use?
For a server system, which holds important (critical) files, I'd strongly recommend a modern filesystem such as ZFS or BTRFS. I've written about ZFS before - even if you're not using any of the "advanced" features, I think it would be a sensible option to consider.
If you're planning on using ZFS, then I'd recommend ~1GB of RAM per TB of usable storage... e.g: for a mirror of 2x 4TB hard disks, I'd recommend at least 4GB of RAM.
You'll see arguments that you "mustn't use ZFS without ECC RAM", but this is largely scaremongering... ECC RAM never hurts - but if you don't have it (e.g: cost) then you're still better off using technology like ZFS.
Alternatives include using LVM, but I'll continue the guide with ZFS...
Identify the Disks
You'll need to identify which disks your data is on. Use lsblk
to narrow down the search... here, I have installed Ubuntu on sda
, while sdb
and sdc
are my "Data" disks. You can see that sda1
is mounted at /
, while sdb1
and sdc1
are not mounted.
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 1.6M 1 loop /snap/gnome-calculator/154
loop1 7:1 0 3.3M 1 loop /snap/gnome-system-monitor/36
loop2 7:2 0 21M 1 loop /snap/gnome-logs/25
loop3 7:3 0 86.6M 1 loop /snap/core/4486
loop4 7:4 0 140M 1 loop /snap/gnome-3-26-1604/59
loop5 7:5 0 12.2M 1 loop /snap/gnome-characters/69
sda 8:0 0 10G 0 disk
└─sda1 8:1 0 10G 0 part /
sdb 8:16 0 5G 0 disk
└─sdb1 8:17 0 5G 0 part
sdc 8:32 0 5G 0 disk
└─sdc1 8:33 0 5G 0 part
Mount Your Data Disk
The NTFS partition that was part of the mirrored set can now be mounted in a temporary location. Use -o ro
to mount it read-only, preventing any accidental writes.
$ mkdir /media/old_ntfs
$ mount -o ro /dev/sdc1 /media/old_ntfs
Install and Setup ZFS
ZFS isn't installed by default, so you'll need to install it.
$ apt install zfsutils-linux
There are many guides for setting up ZFS, so I'm going to do a very brief intro here... you might want to research the ashift
option, using a value of 12 for disks that have 4k sectors - I'm going to leave this out.
Create a pool of one disk - tank
is the name of the pool, -f
forces it to overwrite the existing NTFS filesystem (destroying data on one of the mirrored disks), and you'll need to do this as root (e.g: sudo
):
$ zpool create -f tank /dev/sdb
With zfs status
you can see your ZFS pool's details:
$ zpool status
pool: tank
state: ONLINE
scan: none requested
config:
NAME STATE READ WRITE CKSUM
tank ONLINE 0 0 0
sdb ONLINE 0 0 0
With zfs list
you can now see your ZFS pool mounted on /tank
:
$ zfs list
NAME USED AVAIL REFER MOUNTPOINT
tank 84K 4.81G 24K /tank
Copy the Files
You may want to change the permissions of the pool, and then copy the files across using a tool like rsync
:
$ chown $(id -u):$(id -g) /tank
$ rsync -av /media/old_ntfs/ /tank/ # trailing slashes are important!
Do what you can to confirm that the files have been copied correctly.
Umount the Old NTFS
Unmount the old NTFS filesystem from its temporary location, and tidy up:
$ umount /media/old_ntfs
$ rm -rf /media/old_ntfs
Add the Second Disk to the ZPool
Now that we have the files on ZFS, we can add the second disk to make it into a mirror:
$ zpool attach -f tank sdb sdc
$ zpool status
pool: tank
state: ONLINE
scan: resilvered 1.00G in 0h0m with 0 errors on Sun Jun 3 11:20:49 2018
config:
NAME STATE READ WRITE CKSUM
tank ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
sdb ONLINE 0 0 0
sdc ONLINE 0 0 0
This will likely take some time for you.