PS:

I wrote:
> The optimum size can theoretically be achieved by using the following
> physical partitioning:
> * x GB on the 4 GB disk and the 3 GB disk,
> * y GB on the 4 GB disk and the 2 GB disk, and
> * z GB on the 3 GB disk and the 2 GB disk,
> for a total of x+y+z GB, where x, y, and z solve the following system of
> equations:
> * x+y=4
> * x+z=3
> * y+z=2
> i.e., in standard form:
> * 1x+1y+0z=4
> * 1x+0y+1z=3
> * 0x+1y+1z=2
> The determinant of this system is -2, which is not 0, so this system
> admits a unique solution.

It shall be noted that the relevant determinant of the system is the 
determinant of the left hand side, which is independent of the actual disk 
sizes, so the determinant is always -2 and the system always has a unique 
solution.

So the last remaining question is, under what conditions are the solutions 
x, y, and z nonnegative? (Obviously, a solution with negative x, y, and/or z 
would be useless in practice.)

So consider the system:
* 1x+1y+0z=a
* 1x+0y+1z=b
* 0x+1y+1z=c
(In your example, a=4, b=3, and c=2.)

The best way to get a symbolic solution to this system is Cramer's rule 
(though any other method will give you the same solution), which results in:
* x=(c-a-b)/(-2)=(a+b-c)/2
* y=(b-a-c)/(-2)=(a+c-b)/2
* z=(a-b-c)/(-2)=(b+c-a)/2

It follows that the solutions are nonnegative under the following 
conditions:
* a+b≥c
* a+c≥b
* b+c≥a
which are quite logical. Consider a=4, b=1, and c=1, i.e., disks of 4 GB,
1 GB, and 1 GB. Each of the 1 GB disks can only mirror (at most) 1 of the
4 GB, so where would you want to mirror the remaining 2 GB to?

For any system that does not satisfy the above conditions, assume without 
loss of generality that b+c<a (which can be achieved by reordering the disks 
so that a is the largest), then the optimal achievable RAID 1 is of size b+c 
with x=b, y=c, z=0. (A formal proof of this claim is possible, but this is 
no longer a simple linear system of equations, but a linear system of 
inequalities, so I am going to omit the formal proof here.)

        Kevin Kofler
_______________________________________________
devel mailing list -- devel@lists.fedoraproject.org
To unsubscribe send an email to devel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org

Reply via email to