Menu="Main:5"
Title="Array Operation"
Tag="snowflake-o"
---
$keyfile = file_exists($var['luksKeyfile']);
$encrypt = false;
/* only one of $forced, $missing, or $wrong will be true, or all will be false */
$forced = $missing = $wrong = false;
foreach ($disks as $disk) {
if (strpos($disk['fsType'],'luks:')!==false || ($disk['fsType']=='auto' && (strpos($var['defaultFsType'],'luks:')!==false || $disk['luksState']==2 || $disk['luksState']==3))) {
$encrypt = true;
if (!$keyfile) {
if ($disk['luksState']==0) $forced = true; else $missing = true;
} else {
if ($disk['luksState']==3) $wrong = true;
}
}
}
if ($forced && $missing) $forced = false;
function check_encryption() {
global $forced, $missing, $wrong;
if ($forced) $status = "Enter new key";
elseif ($missing) $status = "Missing key";
elseif ($wrong) $status = "Wrong key";
else return;
echo "
Encryption status:
$statuspermit reformat
";
echo "
Encryption input:
";
echo "
";
echo "
Passphrase:
show passphrase
";
echo "
Retype passphrase:
";
echo "
Keyfile:
";
}
function maintenance_mode() {
echo "
";
echo "
";
echo "
Maintenance mode
";
echo "
Maintenance mode - if checked, Start array but do not mount disks.
";
echo "
";
}
function status_indicator() {
global $var;
switch ($var['mdColor']) {
case 'green-on': $orb = 'circle'; $color = 'green'; $help = 'Started, array protected'; break;
case 'green-blink': $orb = 'circle'; $color = 'grey'; $help = 'Stopped'; break;
case 'yellow-on': $orb = 'warning'; $color = 'yellow'; $help = 'Started, array unprotected'; break;
case 'yellow-blink': $orb = 'warning'; $color = 'grey'; $help = 'Stopped'; break;
}
echo "$help";
}
function missing_cache() {
global $disks;
$missing = false;
foreach ($disks as $disk) if ($disk['type']=='Cache') $missing |= (strpos($disk['status'],'_MISSING')!==false);
return $missing;
}
?>
>>
Spin Down will immediately spin down all disks. Spin Up will immediately spin up all disks.
Clear Statistics will immediately clear all disk statistics.
if (isset($display['sleep'])) @include $display['sleep'];
?>
> **Colored Status Indicator** the significance of the color indicator of the *Array* is as follows:
>
> Array is Started and Parity is valid.
>
> Array is Stopped, Parity is valid.
>
> Array is Started, but Parity is invalid.
>
> Array is Stopped, Parity is invalid.
>
> #### Assigning Devices
>
> An Unraid disk array consists of a single parity disk and a number of data disks. The data
> disks are exclusively used to store user data, and the parity disk provides the redundancy necessary
> to recover from any singe disk failure.
>
> Note that we are careful to use the term *disk* when referring to an array storage device. We
> use the term *hard drive* (or sometimes just *drive*) when referring to an actual hard disk drive (HDD)
> device. This is because in a RAID system it is possible to read/write an array disk whose corresponding
> hard drive is disabled or even missing! In addition, it is useful to be able to ask, "which device is
> assigned to be the parity disk?"; or, "which device corresponds to disk2?".
>
> We therefore need a way to assign hard drives to array disks. This is accomplished here on the
> Main page when the array is stopped. There is a drop-down box for each array disk which lists all the
> unassigned devices. To assign a device simply select it from the list. Each time a device
> assignment is made, the system updates a configuration file to record the assignment.
>
> #### Requirements
>
> Unlike traditional RAID systems which stripe data across all the array devices, an Unraid server
> stores files on individual hard drives. Consequently, all file write operations will involve both the
> data disk the file is being written to, and the parity disk. For these reasons,
>
> * the parity disk size must be as large or larger than any of the data disks,
>
> and
>
> * given a choice, the parity disk should be the fastest disk in your collection.
>
> #### Guidelines
>
> Here are the steps you should follow when designing your Unraid disk array:
>
> 1. Decide which hard drive you will use for parity, and which hard drives you will use for
> data disk1, disk2, etc., and label them in some fashion. Also, find the serial number of each hard
> drive and jot it down somewhere; you will need this information later.
>
> 2. Install your hard drive devices, boot Unraid OS and bring up the webGui. If this is a fresh system
> build, then the Main page will show no disks installed. This doesn't mean the system can't detect your
> hard drives; it just means that none have been assigned yet.
>
> 3. Remember the serial numbers you recored back in step 1? For parity and each data disk, select the
> proper hard drive based on its serial number from the drop down list.
>
> #### Hot Plug
>
> You may also *hot plug* hard drives into your server if your hardware supports it. For example,
> if you are using hard drive cages, you may simply plug them into your server while powered on and
> with array Stopped. Refresh the Main page to have new unassigned devices appear in the assignment
> dropdown lists.
>
> #### Next Steps
>
> Once you have assigned all of your hard drives, refer to the Array Status section below
> and Start the array.
> #### Encryption input
>
> Passphrase or file is stored in /root/keyfile.
> This keyfile is read during array Start and is used to encrypt/decrypt content of encrypted devices.
>
> With array Stopped, the user can specify a new encryption key. Note that once a device
> is formatted with a particular key it may only be opened using that same key. Changing the encryption key requires
> encrypted devices to be reformatted **resulting in permanent loss of all existing data on those devices.**
>
> With array Started, the keyfile may be deleted to ensure there is no encryption key present on the server when
> the array is online. Note that plugins are installed and may execute before and during the array Start process.
>
> #### Passphrase
>
> Enter a passphrase of up to 512 characters. It is highly advisable to only use the 95 printable characters from the
> first 128 characters of the [ASCII table](https://en.wikipedia.org/wiki/ASCII), as they will always have the same binary
> representation. Other characters may have different encoding depending on system configuration and your passphrase will
> not work with a different encoding. If you want a longer passphrase or to include binary data, upload a keyfile instead.
>
> Please refer to the [cryptsetup FAQ](https://gitlab.com/cryptsetup/cryptsetup/wikis/FrequentlyAskedQuestions#5-security-aspects)
> for what constitutes a *secure* passphrase.
>
> **Memorize** this passphrase. **IF LOST, ENCRYPTED CONTENT CANNOT BE RECOVERED!**
>
> #### Keyfile
>
> Select a local keyfile with a stored encryption key or a binary file. The maximum size of the keyfile is 8M (8388608 byte).
>
> **Backup** your local keyfile. **IF LOST, ENCRYPTED CONTENT CANNOT BE RECOVERED!**