Skip to content

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

Enable disk drive LED indication in the drive bay

shell
apt install ledmon

Launch

shell
ledctl locate=/dev/sda

ZFS (Zettabyte File System) ​

Reset errors

shell
zpool clear tank

Start data integrity check

shell
zpool scrub tank

Checking scrub

shell
zpool status

Show activity I/O

shell
zpool iostat -v 1

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

Writing an ISO Image to a USB Drive (macOS) ​

The dd command requires Superuser privileges

shell
diskutil list
diskutil unmountDisk /dev/disk3
sudo dd if="~/Downloads/debian-13-amd64-netinst.iso" of=/dev/rdisk3 bs=1m status=progress
diskutil eject /dev/disk3