Инструменты пользователя

Инструменты сайта


os:linux:troubleshooting

Что ест дисковые ресурсы

top
# wa -- iowait
# Amount of time the CPU has been waiting for I/O to complete.

Processes that are waiting for I/O are commonly in an “uninterruptible sleep” state or “D”; given this information we can simply find the processes that are constantly in a wait state.

for x in `seq 1 1 10`; do ps -eo state,pid,cmd | grep "^D"; echo "----"; sleep 5; done

The above for loop will print the processes in a “D” state every 5 seconds for 10 intervals.

Finding what files are being written too heavily
The lsof command will show you all of the files open by a specific process or all processes depending on the options provided. From this list one can make an educated guess as to what files are likely being written to often based on the size of the file and the amounts present in the “io” file within /proc. To narrow down the output we will use the -p <pid> options to print only files open by the specific process id.

lsof -p <process id>

https://bencane.com/2012/08/06/troubleshooting-high-io-wait-in-linux/

Кончилось место на диске

По версии df -h место кончилось, а du -h показывает, что всё в рамках приличий. Дело в удалённых файлах, которые всё ещё держатся работающим процессом.

# Вывести список
lsof | grep '(deleted)'

Решение - перезапустить или завершить процесс (в моём случае это был mysql).

https://askubuntu.com/questions/280342/why-do-df-and-du-commands-show-different-disk-usage

Доступен ли порт

# netcat (быстро выходит сразу, показывая результат, удобно в скриптах)
# Single port:
nc -zv 127.0.0.1 80
# Multiple ports:
nc -zv 127.0.0.1 22 80 8080
# Range of ports:
nc -zv 127.0.0.1 20-30
 
# Bash тоже умеет:
# If host is a valid hostname or Internet address, and port is an integer port number
# or service name, bash attempts to open a connection to the corresponding socket.
# TCP
/dev/tcp/host/port
# UDP
/dev/udp/host/port
 
echo 2> /dev/null > /dev/tcp/192.168.1.6/443 && echo Success || echo Fail
Success
 
# telnet (ждёт)
telnet 127.0.0.1 22

https://superuser.com/questions/621870/test-if-a-port-on-a-remote-system-is-reachable-without-telnet

os/linux/troubleshooting.txt · Последнее изменение: 20.10.2024 07:52 — viacheslav

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki