This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| deb13:tuning [2026/08/16 14:04] – Bernard Condrau | deb13:tuning [2026/08/16 14:10] (current) – Bernard Condrau | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Tuning ====== | ====== Tuning ====== | ||
| - | ===== (Re)build RAID ===== | ||
| - | |||
| - | ==== Replace a failing or failed disk ==== | ||
| - | - Check the RAID was created< | ||
| - | - Check disk status< | ||
| - | - Find serial number< | ||
| - | - If the new disk contains partitions | ||
| - | - Stop any Raid partitions with< | ||
| - | - Remove the superblocks< | ||
| - | - Remove existing partitions with '' | ||
| - | - Create new RAID partition (if asked remove the existing signature)< | ||
| - | Command (m for help): n | ||
| - | Command (m for help): t, | ||
| - | - Add the new drive to the RAID< | ||
| - | - If the system does not need to use the disks during resync you may want to (temporarily) increase the sync speed:< | ||
| - | - If the RAID is incomplete, rebuilding (resyncing) of the RAID starts instantly. If the RAID is complete including the bad drive, and you just added a spare drive, you can proceed as follows (requires mdadm 3.3+ and a 3.2+ kernel)< | ||
| - | - Remove the replaced disk which is marked as failed after resyncing has completed< | ||
| - | - Remove a disk from the array which was physically removed before< | ||
| - | - Compare ouput of '' | ||
| - | |||
| - | |||
| - | * [[https:// | ||
| - | * [[https:// | ||
| - | * [[http:// | ||
| - | * [[https:// | ||
| - | * [[https:// | ||
| - | * [[https:// | ||
| - | * [[http:// | ||
| - | * [[http:// | ||
| - | * [[https:// | ||
| - | * [[http:// | ||
| - | * [[http:// | ||
| - | * [[https:// | ||
| - | * [[https:// | ||
| - | * [[https:// | ||
| - | * [[https:// | ||
| - | * [[https:// | ||
| - | |||
| - | ==== Check wether all volumes get mounted during system boot ==== | ||
| - | * to check wether root and swap are mounted, enter:< | ||
| - | free -m -t</ | ||
| - | * to check mismatching uuid' | ||
| - | ls -la / | ||
| - | cat / | ||
| - | * to fix, replace the uuid's found in ''/ | ||
| - | |||
| - | |||
| - | ===== Resync ===== | ||
| - | Most Debian and Debian-derived distributions create a cron job which issues an array check at 0106 hours each first Sunday of the month in / | ||
| - | |||
| - | Normally the kernel will throttle the resync activity (c.f. [[https:// | ||
| - | |||
| - | However, it is a good idea to manage the resync parameters to get optimal performance. | ||
| - | |||
| - | ==== Raid 1, 5, 6 ==== | ||
| - | === Rebuild speed === | ||
| - | * Get current system values:< | ||
| - | sudo sysctl dev.raid.speed_limit_max</ | ||
| - | * Default system values on Debian 10:< | ||
| - | dev.raid.speed_limit_max = 200, | ||
| - | * Reduce max limit to make server more responsive during resync (2021-12-05):< | ||
| - | sudo sysctl -w dev.raid.speed_limit_max=100, | ||
| - | |||
| - | === read-ahead === | ||
| - | * Get current read-ahead (in 512-byte sectors) per Raid device (default value is 512 on Debian 10):< | ||
| - | * Set to 32 MB:< | ||
| - | * Set to 65536 on a server with 32GB memory, 32768 on a server with 8GB memory (2021-12-05) | ||
| - | |||
| - | === Disable NCQ === | ||
| - | * Get NCQ depth on each physical Drive in Raid (default value is 31):< | ||
| - | * Disable NCQ:< | ||
| - | |||
| - | ==== Raid 5, 6 only ==== | ||
| - | === stripe_cache_size === | ||
| - | It records the size (in pages per device) of the stripe cache which is used for synchronising all write operations to the array and all read operations if the array is degraded. The default is 256 which equals to 3MB memory consumption. | ||
| - | * Find system page size, on Debian 10 this is 4096:< | ||
| - | * Set to 384MB memory consumption on a 3 disk:< | ||
| - | * Set to 32768 on a server with 32 GB memory, set to 16384 on a server with 8 GB memory (2021-12-05) | ||
| - | |||
| - | ===== Prepare RAID with single disk ===== | ||
| - | ==== Prepare new disk ==== | ||
| - | - If the new disk contains partitions | ||
| - | - Stop any Raid partitions with< | ||
| - | mdadm --remove / | ||
| - | - Remove the superblocks< | ||
| - | - Remove existing partitions with '' | ||
| - | - Create a new partition utilizing the full disk space. When asked, remove the existing signature. Change partition type to '' | ||
| - | Command (m for help): d | ||
| - | Command (m for help): n | ||
| - | Command (m for help): t, | ||
| - | - Create the RAID< | ||
| - | - Check the RAID was created< | ||
| - | ls / | ||
| - | - Add a second disk< | ||
| - | ==== Links ==== | ||
| - | * [[https:// | ||
| - | * [[https:// | ||
| - | * [[https:// | ||
| - | * [[https:// | ||
| - | ===== Move RAID to a new machine ===== | ||
| - | - Scan for the old raid disks< | ||
| - | - Mount the raid manually to confirm< | ||
| - | sudo mount /dev/md0 / | ||
| - | - Append info to mdadm.conf< | ||
| - | - Update initramfs< | ||
| - | |||
| - | ==== Troubleshooting ==== | ||
| - | * Make sure the output of "mdadm --detail --scan" | ||
| - | * Examine /etc/fstab | ||
| - | |||
| - | ==== Links ==== | ||
| - | * [[https:// | ||
| - | * [[https:// | ||
| - | * [[https:// | ||
| - | |||
| - | ===== Increase drive capacity in a RAID -> LVM -> CRYPT setup ===== | ||
| - | ==== Replace drives in RAID ==== | ||
| - | - Follow [[# | ||
| - | - Resize the array to the maximum supported by the underlying partitions< | ||
| - | - Follow the progress with< | ||
| - | |||
| - | ==== Increase LVM ==== | ||
| - | - Check size of physical volume with< | ||
| - | - Increase physical volume to utilize all available space< | ||
| - | - Increase logical volume to utilize all available space< | ||
| - | |||
| - | ==== Increase LUKS ==== | ||
| - | - Inform LUKS to utilize all available space, you need the backup key to do this< | ||
| - | |||
| ===== Swap behavior ===== | ===== Swap behavior ===== | ||
| * Set swappiness to 10 in ''/ | * Set swappiness to 10 in ''/ | ||
| Line 134: | Line 5: | ||
| cat / | cat / | ||
| - | ===== (Re)build RAID ===== | + | ===== Network |
| + | ==== Test performance ==== | ||
| + | * Install iperf on client and host machine< | ||
| + | * Open firewall on host< | ||
| + | * Test network from client to host< | ||
| + | iperf3 -c < | ||
| + | * Test disk access< | ||
| - | ==== Replace a failing or failed disk ==== | + | ==== Speedtest |
| - | | + | |
| - | - Check disk status< | + | |
| - | - Find serial number< | + | |
| - | - If the new disk contains partitions | + | speedtest-cli</ |
| - | - Stop any Raid partitions with< | + | |
| - | - Remove | + | |
| - | - Remove existing partitions with '' | + | |
| - | - Create new RAID partition (if asked remove the existing signature)< | + | |
| - | Command (m for help): n | + | |
| - | Command (m for help): t,fd00</code> | + | |
| - | | + | |
| - | - If the system does not need to use the disks during resync you may want to (temporarily) increase the sync speed:< | + | |
| - | | + | |
| - | - Remove the replaced disk which is marked as failed after resyncing has completed< | + | |
| - | - Remove a disk from the array which was physically removed before< | + | |
| - | - Compare ouput of '' | + | |
| + | ==== CPU and IO priorities ==== | ||
| + | * IO priority< | ||
| + | ionice -c 3 cp / | ||
| - | * [[https:// | ||
| - | * [[https:// | ||
| - | * [[http:// | ||
| - | * [[https:// | ||
| - | * [[https:// | ||
| - | * [[https:// | ||
| - | * [[http:// | ||
| - | * [[http:// | ||
| - | * [[https:// | ||
| - | * [[http:// | ||
| - | * [[http:// | ||
| - | * [[https:// | ||
| - | * [[https:// | ||
| - | * [[https:// | ||
| - | * [[https:// | ||
| - | * [[https:// | ||
| - | |||
| - | ==== Check wether all volumes get mounted during system boot ==== | ||
| - | * to check wether root and swap are mounted, enter:< | ||
| - | free -m -t</ | ||
| - | * to check mismatching uuid' | ||
| - | ls -la / | ||
| - | cat / | ||
| - | * to fix, replace the uuid's found in ''/ | ||
| - | |||
| - | |||
| - | ===== Resync ===== | ||
| - | Most Debian and Debian-derived distributions create a cron job which issues an array check at 0106 hours each first Sunday of the month in / | ||
| - | |||
| - | Normally the kernel will throttle the resync activity (c.f. [[https:// | ||
| - | |||
| - | However, it is a good idea to manage the resync parameters to get optimal performance. | ||
| - | |||
| - | ==== Raid 1, 5, 6 ==== | ||
| - | === Rebuild speed === | ||
| - | * Get current system values:< | ||
| - | sudo sysctl dev.raid.speed_limit_max</ | ||
| - | * Default system values on Debian 10:< | ||
| - | dev.raid.speed_limit_max = 200, | ||
| - | * Reduce max limit to make server more responsive during resync (2021-12-05):< | ||
| - | sudo sysctl -w dev.raid.speed_limit_max=100, | ||
| - | |||
| - | === read-ahead === | ||
| - | * Get current read-ahead (in 512-byte sectors) per Raid device (default value is 512 on Debian 10):< | ||
| - | * Set to 32 MB:< | ||
| - | * Set to 65536 on a server with 32GB memory, 32768 on a server with 8GB memory (2021-12-05) | ||
| - | |||
| - | === Disable NCQ === | ||
| - | * Get NCQ depth on each physical Drive in Raid (default value is 31):< | ||
| - | * Disable NCQ:< | ||
| - | |||
| - | ==== Raid 5, 6 only ==== | ||
| - | === stripe_cache_size === | ||
| - | It records the size (in pages per device) of the stripe cache which is used for synchronising all write operations to the array and all read operations if the array is degraded. The default is 256 which equals to 3MB memory consumption. | ||
| - | * Find system page size, on Debian 10 this is 4096:< | ||
| - | * Set to 384MB memory consumption on a 3 disk:< | ||
| - | * Set to 32768 on a server with 32 GB memory, set to 16384 on a server with 8 GB memory (2021-12-05) | ||
| - | |||
| - | ===== Prepare RAID with single disk ===== | ||
| - | ==== Prepare new disk ==== | ||
| - | - If the new disk contains partitions | ||
| - | - Stop any Raid partitions with< | ||
| - | mdadm --remove / | ||
| - | - Remove the superblocks< | ||
| - | - Remove existing partitions with '' | ||
| - | - Create a new partition utilizing the full disk space. When asked, remove the existing signature. Change partition type to '' | ||
| - | Command (m for help): d | ||
| - | Command (m for help): n | ||
| - | Command (m for help): t, | ||
| - | - Create the RAID< | ||
| - | - Check the RAID was created< | ||
| - | ls / | ||
| - | - Add a second disk< | ||
| ==== Links ==== | ==== Links ==== | ||
| - | * [[https://unix.stackexchange.com/questions/ | + | * [[https://www.maketecheasier.com/manage-priority-io-processes-linux/|How to Manage the Priority of I/O Processes in Linux]] |
| - | * [[https://wiki.archlinux.org/title/Convert_a_single_drive_system_to_RAID|Convert a single drive system to RAID]] | + | * [[http://manpages.ubuntu.com/manpages/bionic/man1/ionice.1.html|ionice]] |
| - | * [[https://bobcares.com/ | + | * [[https://bugs.gentoo.org/show_bug.cgi? |
| - | * [[https://www.howtoforge.com/replacing_hard_disks_in_a_raid1_array|Replacing A Failed Hard Drive In A Software RAID1 Array]] | + | * [[https:// |
| - | ===== Move RAID to a new machine ===== | + | * [[https://www.ittsystems.com/network-throughput/|What is Network Throughput and How to Measure & Monitor it!]] |
| - | - Scan for the old raid disks< | + | * [[https://software.es.net/iperf/invoking.html|Invoking iperf3]] |
| - | - Mount the raid manually to confirm< | + | |
| - | sudo mount /dev/md0 / | + | |
| - | - Append info to mdadm.conf< | + | |
| - | - Update initramfs< | + | |
| - | + | ||
| - | ==== Troubleshooting ==== | + | |
| - | * Make sure the output of "mdadm --detail --scan" | + | |
| - | * Examine / | + | |
| - | + | ||
| - | ==== Links ==== | + | |
| - | * [[https:// | + | |
| - | * [[https://unix.stackexchange.com/questions/ | + | |
| - | * [[https://askubuntu.com/questions/729370/ | + | |
| - | + | ||
| - | ===== Increase drive capacity in a RAID -> LVM -> CRYPT setup ===== | + | |
| - | ==== Replace drives in RAID ==== | + | |
| - | - Follow [[# | + | |
| - | - Resize the array to the maximum supported by the underlying partitions< | + | |
| - | - Follow the progress with< | + | |
| - | + | ||
| - | ==== Increase LVM ==== | + | |
| - | - Check size of physical volume with< | + | |
| - | - Increase physical volume to utilize all available space< | + | |
| - | - Increase logical volume to utilize all available space< | + | |
| - | + | ||
| - | ==== Increase LUKS ==== | + | |
| - | - Inform LUKS to utilize all available space, you need the backup key to do this< | + | |
| - | + | ||