Thursday, July 28, 2016

Intel RAID: Create mirror RAID from existing disk

What you want

If you have Intel RAID, drive wish information and drive which have to become its mirror, this page is for you.

Drive 1: your information is here;
Drive 2: you want to use this for mirror.

Intel BIOS Options

Intel BIOS do not give you opportunity to use Drive 1 as source for the RAID. In the BIOS you could create RAID, but it will destroy all data on both drives. The options are:
1.Select Recovery Volume Option
2.Enable Only Recovery Disk – enables recovery disk if available and disables master
disk.
3. Enable Only Master Disk – enables master disk if available and disables recovery disk

The solution

You cannot do this in BIOS. You have to boot into Windows from Disk 1, install progam Intel xxx, which has the feature which you want. The syncing is 2 or 3 times slower than expected.

The result is that you will see in BIOS that both drives are in RAID.

Why generics of type are used?

Definitions

Lets have these classes:

public class SuperClass {
   // some methods
}

public class SubClass extends SuperClass{
   // some methods
}

So we are allowed to do this conversion:

SuperClass x = new SupClass();

Limitation

But, we are not allowed to make such conversion:

List <SubClass> listSubs = ...
List <SuperClass> listSupers = listSubs; // compile time error happens

Such a stupid language limitation! In this case, there is no clean solution. The bad solutions produce new List and reinserts all elements into it.

Solution

But we could use "? extends Generics" structure in this way:

List <SubClass> listSubs = ...
List <? extends SuperClass> listSupers = listSubs; // NO errors

Note: It is normal that ? extends Class structure allows only supclasses of the generics to be used. I was glad to understand that you could use the generics type itself there. So it is also possible:

List <? extends SuperClass> listSupers = new LinkedList(); // NO errors

Error: "class or interface without bounds" solved

Example:
    public List<? extends SuperClass> getObjects() {
        List<? extends SuperClass> result = new ArrayList<? extends SuperClass>(1); // error: "class or interface without bounds"
        result.add( theNeededObject ); // error: "not suitable method found for ..."
        return result;
    }

Fixed error:
    public List<? extends SuperClass> getObjects() {
        List<SuperClass> result = new ArrayList<>(1);
        result.add( theNeededObject );
        return result; // it is automatically converted from <SuperClass> to "<? extends SuperClass>"
    }