Tips for working with disks and storage systems
Linux Software RAID (Multiple Device/MD)
Display all processes busy the RAID md1
shell
lsof +f -- /dev/md1
Get speed value of KByte for all RAID disks
shell
sysctl dev.raid.speed_limit_max
Set limit speed value of KByte for all RAIDs
shell
sysctl -w dev.raid.speed_limit_max=80000
Set limit speed sync/check only for the RAID md1
shell
echo 80000 > /sys/block/md1/md/sync_speed_max
Will start the RAID md1 check process
shell
echo check > /sys/block/md1/md/sync_action
Will stop the ongoing check, resync, or recovery process for RAID md1
shell
echo idle > /sys/block/md1/md/sync_action
Включить индикацию диода у диска в корзине
shell
apt install ledmon
shell
ledctl locate=/dev/sda
Analytics
Show which processes have written the most data to disk
shell
iotop -oPa -d 1
next, find the parent
shell
pstree -asp 12345
List of open process files
shell
lsof -p 12345
SWAP file
Commands require
Superuser
privileges
Creating a SWAP of 1GB
with a greed of 10%
shell
cat /proc/sys/vm/swappiness && \
sysctl vm.swappiness=10 && \
echo "vm.swappiness=10" >> /etc/sysctl.conf && \
fallocate -l 1G /swapfile && \
chmod 600 /swapfile && \
mkswap /swapfile && \
swapon /swapfile && \
echo "/swapfile swap swap defaults 0 0" >> /etc/fstab
Clearing the SWAP
shell
sudo swapoff -a && sudo swapon -a && free -m