Files
webgui/plugins/dynamix/DiskSettings.page
2020-03-04 17:33:46 +01:00

365 lines
16 KiB
Plaintext

Menu="OtherSettings"
Title="Disk Settings"
Icon="icon-disks"
Tag="icon-disk"
---
<?PHP
/* Copyright 2005-2020, Lime Technology
* Copyright 2012-2020, Bergware International.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*/
?>
<?
require_once "$docroot/webGui/include/Preselect.php";
$events = explode('|',$var['smEvents'] ?? $numbers);
function displayTemp($temp) {
global $display;
return $display['unit']=='F' ? round(9/5*$temp)+32 : $temp;
}
?>
<style>
span.code{display:inline-block;width:186px}
</style>
<script>
function doDispatch(form) {
var fields = {};
<?if ($display['unit']=='F'):?>
form.display_hot.value = Math.round((form.display_hot.value-32)*5/9);
form.display_max.value = Math.round((form.display_max.value-32)*5/9);
<?endif;?>
fields['#cfg'] = "/boot/config/plugins/dynamix/dynamix.cfg";
fields['#cleanup'] = true;
$(form).find('input[name^="display_"]').each(function(){fields[$(this).attr('name')] = $(this).val(); $(this).prop('disabled',true);});
$.post('/webGui/include/Dispatcher.php',fields);
}
function prepareDiskSettings(form) {
var events = [];
for (var i=0; i < <?=count($preselect)?>; i++) {
if (form.elements['at'+i].checked) events.push(form.elements['at'+i].value);
form.elements['at'+i].disabled = true;
}
var custom = form.smCustom.value.trim();
var custom = custom.length ? custom.split(',') : [];
for (var i=0; i < custom.length; i++) events.push(custom[i].trim());
form.smEvents.value = events.join('|');
if (form.smEvents.value == '<?=$numbers?>') form.smEvents.value = '';
if (form.smLevel.value == 1.00) form.smLevel.value = '';
}
function setIndex(form) {
form.smIndex.value = form.smType.selectedIndex;
}
</script>
<form markdown="1" method="POST" action="/update.htm" target="progressFrame" onsubmit="doDispatch(this)">
_(Enable auto start)_:
: <select name="startArray" size="1">
<?=mk_option($var['startArray'], "no", _('No'))?>
<?=mk_option($var['startArray'], "yes", _('Yes'))?>
</select>
:help11
> If set to 'Yes' then if the device configuration is correct upon server start-up,
> the array will be automatically Started and shares exported.<br>
> If set to 'No' then you must Start the array yourself.
:end
_(Default spin down delay)_:
: <select name="spindownDelay" size="1">
<?=mk_option($var['spindownDelay'], "0", _('Never'))?>
<?=mk_option($var['spindownDelay'], "15", "15 "._('minutes'))?>
<?=mk_option($var['spindownDelay'], "30", "30 "._('minutes'))?>
<?=mk_option($var['spindownDelay'], "45", "45 "._('minutes'))?>
<?=mk_option($var['spindownDelay'], "1", "1 "._('hour'))?>
<?=mk_option($var['spindownDelay'], "2", "2 "._('hours'))?>
<?=mk_option($var['spindownDelay'], "3", "3 "._('hours'))?>
<?=mk_option($var['spindownDelay'], "4", "4 "._('hours'))?>
<?=mk_option($var['spindownDelay'], "5", "5 "._('hours'))?>
<?=mk_option($var['spindownDelay'], "6", "6 "._('hours'))?>
<?=mk_option($var['spindownDelay'], "7", "7 "._('hours'))?>
<?=mk_option($var['spindownDelay'], "8", "8 "._('hours'))?>
<?=mk_option($var['spindownDelay'], "9", "9 "._('hours'))?>
</select>
:help12
> This setting defines the 'default' time-out for spinning hard drives down after a period
> of no I/O activity. You may override the default value for an individual disk on the Disk Settings
> page for that disk.
:end
_(Enable spinup groups)_:
: <select name="spinupGroups" size="1">
<?=mk_option($var['spinupGroups'], "no", _('No'))?>
<?=mk_option($var['spinupGroups'], "yes", _('Yes'))?>
</select>
:help13
> If set to 'Yes' then the [Spinup Groups](/Help) feature is enabled.
:end
_(Default partition format)_:
: <select name="defaultFormat" size="1">
<?=mk_option($var['defaultFormat'], "1", _('MBR: unaligned'))?>
<?=mk_option($var['defaultFormat'], "2", _('MBR: 4K-aligned'))?>
</select>
:help14
> Defines the type of partition layout to create when formatting hard drives 2TB in size and
> smaller **only**. (All devices larger then 2TB are always set up with GPT partition tables.)
>
> **MBR: unaligned** setting will create MBR-style partition table, where the single
> partition 1 will start in the **63rd sector** from the start of the disk. This is the *traditional*
> setting for virtually all MBR-style partition tables.
>
> **MBR: 4K-aligned** setting will create an MBR-style partition table, where the single
> partition 1 will start in the **64th sector** from the start of the disk. Since the sector size is 512 bytes,
> this will *align* the start of partition 1 on a 4K-byte boundry. This is required for proper
> support of so-called *Advanced Format* drives.
>
> Unless you have a specific requirement do not change this setting from the default **MBR: 4K-aligned**.
:end
_(Default file system)_:
: <select name="defaultFsType" size="1">
<?=mk_option($var['defaultFsType'], "xfs", _('xfs'));?>
<?=mk_option($var['defaultFsType'], "btrfs", _('btrfs'));?>
<?=mk_option($var['defaultFsType'], "reiserfs", _('reiserfs'));?>
<?=mk_option($var['defaultFsType'], "luks:xfs", _('xfs')." - "._('encrypted'));?>
<?=mk_option($var['defaultFsType'], "luks:btrfs", _('btrfs')." - "._('encrypted'));?>
<?=mk_option($var['defaultFsType'], "luks:reiserfs", _('reiserfs')." - "._('encrypted'));?>
</select>
:help15
> Defines the default file system type to create when an *unmountable* array device is formatted.
>
> The default file system type for a single or multi-device cache is always Btrfs.
:end
_(Shutdown time-out)_:
: <input type="text" name="shutdownTimeout" maxlength="10" value="<?=$var['shutdownTimeout']?>" class="narrow">
:help16
> When shutting down the server, this defines how long to wait in seconds for *graceful* shutdown before forcing
> shutdown to continue.
:end
_(Tunable (poll_attributes))_:
: <input type="text" name="poll_attributes" maxlength="10" value="<?=$var['poll_attributes']?>" class="narrow"><?=_($var['poll_attributes_status'])?>
:help17
> This defines the disk SMART polling interval, in seconds. A value of 0 disables SMART polling (not recommended).
:end
_(Tunable (enable NCQ))_:
: <select name="queueDepth" size="1">
<?=mk_option($var['queueDepth'], "auto", _('Auto'))?>
<?=mk_option($var['queueDepth'], "1", _('No'))?>
</select>
:help18
> If set to **No** then *Native Command Queuing* is disabled for all array devices that support NCQ.
>
> **Auto** leaves the setting for each device as-is.
>
> Note: You must reboot after selecting Auto for setting to take effect.
:end
_(Tunable (nr_requests))_:
: <input type="text" name="nr_requests" maxlength="10" value="<?=$var['nr_requests']?>" class="narrow"><?=_($var['nr_requests_status'])?>
:help19
> This defines the `nr_requests` device driver setting for all array devices.
>
> **Auto** leaves the setting for each device as-is.
>
> Note: if you set to blank and click Apply, the setting is restored to its default, and you must reboot for setting to take effect.
:end
_(Tunable (scheduler))_:
: <select name="md_scheduler" size="1">
<?=mk_option($var['md_scheduler'], "auto", _('Auto'))?>
<?=mk_option($var['md_scheduler'], "mq-deadline", _('mq-deadline'))?>
<?=mk_option($var['md_scheduler'], "kyber", _('kyber'))?>
<?=mk_option($var['md_scheduler'], "bfq", _('bfq'))?>
<?=mk_option($var['md_scheduler'], "none", _('none'))?>
</select>
:help20
> Selects which kernel I/O scheduler to use for all array devices.
>
> **Auto** leaves the setting for each device as-is (mq-deadline).
>
> Note: You must reboot after selecting Auto for setting to take effect.
:end
_(Tunable (md_num_stripes))_:
: <input type="text" name="md_num_stripes" maxlength="10" value="<?=$var['md_num_stripes']?>" class="narrow"><?=_($var['md_num_stripes_status'])?>
:help21
> This is the size of the *stripe pool* in number of *stripes*. A *stripe* refers to a data structure that faclitiates parallel 4K read/write
> operations necessary for a parity-protected array.
>
> Note: if you set to blank and click Apply, the setting is restored to its default, and will take effect after reboot.
:end
_(Tunable (md_queue_limit))_:
: <input type="text" name="md_queue_limit" maxlength="10" value="<?=$var['md_queue_limit']?>" class="narrow"><?=_($var['md_queue_limit_status'])?>
:help22
> This is a number in [1..100] which is the maximum steady-load percentage of the stripe pool permitted to be in use.
>
> Note: if you set to blank and click Apply, the setting is restored to its default.
:end
_(Tunable (md_sync_limit))_:
: <input type="text" name="md_sync_limit" maxlength="10" value="<?=$var['md_sync_limit']?>" class="narrow"><?=_($var['md_sync_limit_status'])?>
:help23
> This is a number in [0..100] which is the maximum percentage of the stripe pool allocated for parity sync/check in the presence of other I/O.
>
> Note: if you set to blank and click Apply, the setting is restored to its default.
:end
_(Tunable (md_write_method))_:
: <select name="md_write_method" size="1">
<?=mk_option($var['md_write_method'], "auto", _('Auto'))?>
<?=mk_option($var['md_write_method'], "0", _('read/modify/write'))?>
<?=mk_option($var['md_write_method'], "1", _('reconstruct write'))?>
</select>
:help24
> Selects the method to employ when writing to enabled disk in parity protected array.
>
> *Auto* selects `read/modify/write`.
:end
_(Default warning disk utilization threshold)_ (%):
: <input type="number" min="0" max="100" name="display_warning" class="narrow" value="<?=$display['warning']?>">
:help25
> *Warning disk utilization* sets the default warning threshold for all hard disks utilization. Exceeding this threshold will result in a warning notification.
>
> When the warning threshold is set equal or greater than the critical threshold, there will be only critical notifications (warnings are not existing).
>
> A value of zero will disable the warning threshold (including notifications).
:end
_(Default critical disk utilization threshold)_ (%):
: <input type="number" min="0" max="100" name="display_critical" class="narrow" value="<?=$display['critical']?>">
:help26
> *Critical disk utilization* sets the default critical threshold for all hard disks utilization. Exceeding this threshold will result in an alert notification.
>
> A value of zero will disable the critical threshold (including notifications).
:end
_(Default warning disk temperature threshold)_ (&deg;<?=$display['unit']?>):
: <input type="number" min="0" max="300" name="display_hot" class="narrow" value="<?=displayTemp($display['hot'])?>">
:help27
> *Warning disk temperature* sets the default warning threshold for all hard disks temperature. Exceeding this threshold will result in a warning notification.
>
> A value of zero will disable the warning threshold (including notifications).
:end
_(Default critical disk temperature threshold)_ (&deg;<?=$display['unit']?>):
: <input type="number" min="0" max="300" name="display_max" class="narrow" value="<?=displayTemp($display['max'])?>">
:help28
> *Critical disk temperature* sets the default critical threshold for all hard disks temperature. Exceeding this threshold will result in an alert notification.
>
> A value of zero will disable the critical threshold (including notifications).
:end
&nbsp;
: <input type="submit" name="changeDisk" value="_(Apply)_" disabled><input type="button" value="_(Done)_" onclick="done()">
</form>
<div id="title"><span class="left"><i class="title fa fa-plus-square"></i>_(Global SMART Settings)_</span></div>
<form markdown="1" name="smart_settings" method="POST" action="/update.php" target="progressFrame" onsubmit="prepareDiskSettings(this)">
<input type="hidden" name="#file" value="/boot/config/smart-all.cfg">
<input type="hidden" name="#include" value="webGui/include/update.smart.php">
<input type="hidden" name="#cleanup" value="true">
<input type="hidden" name="#top" value="1">
<input type="hidden" name="smEvents" value="">
<input type="hidden" name="smIndex" value="0">
_(Default SMART notification value)_:
: <select name="smSelect" size="1">
<?=mk_option($var['smSelect'], "0", _('Raw'))?>
<?=mk_option($var['smSelect'], "1", _('Normalized'))?>
</select>
:help29
> SMART notifications are generated on either an increasing RAW value of the attribute, or a decreasing NORMALIZED value which reaches a predefined threshold set by the manufacturer.
>
> This section is used to set the global settings for all disks. It is possible to adjust settings for individual disks.
:end
_(Default SMART notification tolerance level)_:
: <select name="smLevel" size="1">
<?=mk_option($var['smLevel'], "1.00", _('Absolute'))?>
<?=mk_option($var['smLevel'], "1.05", "5%")?>
<?=mk_option($var['smLevel'], "1.10", "10%")?>
<?=mk_option($var['smLevel'], "1.15", "15%")?>
<?=mk_option($var['smLevel'], "1.20", "20%")?>
<?=mk_option($var['smLevel'], "1.25", "25%")?>
<?=mk_option($var['smLevel'], "1.50", "50%")?>
</select>
:help30
> A tolerance level may be given to prevent that small changes result in a notification. Setting a too high tolerance level may result in critical changes without a notification.
>
> This section is used to set the global settings for all disks. It is possible to adjust settings for individual disks.
:end
_(Default SMART controller type)_:
: <select name="smType" size="1" onchange="setIndex(this.form)">
<?=mk_option($var['smType'], "", _('Automatic'))?>
<?=mk_option($var['smType'], "-d ata", "ATA")?>
<?=mk_option($var['smType'], "-d nvme", "NVMe")?>
<?=mk_option($var['smType'], "-d sat", "SAT")?>
<?=mk_option($var['smType'], "-d scsi", "SCSI")?>
<?=mk_option($var['smType'], "-d 3ware", "3Ware")?>
<?=mk_option($var['smType'], "-d aacraid", "Adaptec")?>
<?=mk_option($var['smType'], "-d areca", "Areca")?>
<?=mk_option($var['smType'], "-d hpt", "HighPoint")?>
<?=mk_option($var['smType'], "-d cciss", "HP cciss")?>
<?=mk_option($var['smType'], "-d marvell", "Marvell")?>
<?=mk_option($var['smType'], "-d megaraid", "MegaRAID")?>
</select>
:help31
> By default automatic controller selection is done by smartctl to read the SMART information. Certain controllers however need specific settings for smartctl to work.
> Use this setting to select your controller type and fill-in the specific disk index and device name for your situation. Use the manufacturer's documentation to find the relevant information.
>
> This section is used to set the global settings for all disks. It is possible to adjust settings for individual disks.
:end
_(Default SMART attribute notifications)_:
: <input type="text" name="smCustom" value="<?=$var['smCustom']?>" class="narrow">_(Custom attributes (use comma to separate numbers))_
<?for ($x = 0; $x < count($preselect); $x++):?>
&nbsp;
: <input type="checkbox" name="at<?=$x?>" value="<?=$preselect[$x]['code']?>"<?=in_array($preselect[$x]['code'],$events)?' checked':''?>><span class="code">_(Attribute)_ = <?=$preselect[$x]['code']?></span><?=$preselect[$x]['text']?>
<?endfor;?>
:help32
> The user can enable or disable notifications for the given SMART attributes. It is recommended to keep the default, which is ALL selected attributes,
> when certain attributes are not present on your hard disk or do not provide the correct information, these may be excluded.
> In addition custom SMART attributes can be entered to generate notifications. Be careful in this selection,
> it may cause an avalance of notifcations if inappropriate SMART attributes are chosen.
>
> This section is used to set the global settings for all disks. It is possible to adjust settings for individual disks.
:end
<input type="submit" name="#default" value="_(Default)_">
: <input type="submit" name="#apply" value="_(Apply)_" disabled><input type="button" value="_(Done)_" onclick="done()">
</form>