See if a long process is stuck or is it reading or writing to disk
##############################################
Imagine you have a process runing but it seems stuck, here is how to see waht its doing
1 2 |
# apt-get install strace # apt-get install sysstat |
Follow a running process (That might seem stuck)
Get its pid:
1 |
# ps aux |
Follow it:
1 |
# strace -p PID |
EXAMPLE : i notice reads that are happening with 4096 block size (thats 4k)
on a long you can see if its reading or writing and at what blocksize
# iostat -t 5
NOTE: -t just to show you time, its optional
Take “kB_read/s” divide by “tps” (transactions per second, io per second)
Should be the same, I get 4 (meaning 4k)
Thus in my situation
btrfsck --fix-crc <dev> looks stuck but its not
Do an experiment
——————–
copy a big file that will take some time to copy
1 |
# strace cp bigfile bigfilecopy |
You will notice that its copying at 32768 chunk
doing a
1 |
# iostat -t 10 |
shows that its copying copying at 32k
1 |
# strace dd if=bigfile of=bigfilecopy512 bs=512 |
you will notice that its copying at 512 byte block size just as expected
CONCLUTION: copy is like a dd with a blocksize set to 32k