Skip to content
Andrei Montchik edited this page Jul 2, 2024 · 13 revisions

Utils

iotop - IO usage monitor by process

  1. Install: sudo apt install oitop
  2. Run: sudo iotop

iostat - disk utilization monitor for specific disks

  1. Install: sudo apt install sysstat
  2. Identify disk of interest: sudo lsblk
  3. Run: iostat -dzx 1

nvme - disk health check utility

  1. Install: sudo apt install nvme-cli
  2. Check the overall disk health: sudo nvme smart-log /dev/nvme0n1
  3. Review the SMART log: sudo nvme error-log /dev/nvme0n1

How to

Partition and format new Disk

  1. Install the gdisk util to create partitions larger than 2TB: sudo apt install gdisk.
  2. Identify the disk: sudo fdisk -l.
  3. Run gdisk for the selected disk: sudo gdisk /dev/nvme1n1.
  4. Select n to create new partition.
  5. Accept the default partition number.
  6. Accept the default starting and ending sectors.
  7. Accept the default partition type.
  8. After the partition is created, type p to review it.
  9. Type w to write the changes to disk.
  10. Confirm that the new partition was created: lsblk -a.
  11. Format new partition: sudo mkfs -t ext4 /dev/nvme1n1p1.
  12. Use sudo lsblk -f to confirm that the newly created partition is formatted. It should show the ext4 FSTYPE for it.

Create Mount

  • Create mount:
    1. Create the new mount directory: sudo mkdir /mnt/ledger
    2. Check available partitions: lsblk -a.
    3. Mount available partition: sudo mount /dev/nvme0n1p1 /mnt/ledger
    4. Update the mount directory ownership: sudo chown sol:sol /mnt/ledger
    5. Add new mount to /etc/fstab: /dev/nvme0n1p1 /mnt/ledger ext4 defaults 0 2
    6. Run mounts sudo mount -a or restart the server.

Check the disk speed

  1. Format and mount the disk fdisk -l.
  2. Write: sudo dd if=/dev/zero of=/mnt/<mount name>/testfile bs=1M count=1000 conv=fdatasync
  3. Read: sudo dd if=/home/sol/testfile of=/dev/null bs=1M

Tuning

Increase number of allowed open file descriptors

  1. Check: ulimit -n
  2. Add the following to /etc/security/limits.conf:
*               soft     nofile         1000000 
*               hard     nofile         1000000
  1. Reboot: sudo reboot.

CLI

  • Disks information: sudo sfdisk -l or sudo lsblk -f
  • UUID of the host disks: sudo blkid
  • Review the currently open files: sudo lsof +D /dev/shm/
  • Largest in current mount: sudo du -a / | sort -n -r | head -n 10
  • Largest in current directory: sudo du -Sh * | sort -rh | head -10
  • Size of all files and subdirs in current directory: sudo du -ah --max-depth=1
  • Grand total of current directory: du -sh

Clone this wiki locally