How to , and other stuff about linux, photo, php … A linux, photography blog. To remember some linux situation, and fix them quickly.

December 3, 2013

Linux Wait IO Problem

Filed under: Linux — Tags: , , , , — admin @ 3:27 pm

One of the problem that is related to my latest post is the Wait IO problem. So if in top or other state command you see WA then is a problem with your IO.
But how to figure out what is the problem ?

Well first of all you can take a look on how your server is going with the waiting.
You can run vmstat to see what is happening.

vmstat 2
procs ———–memory———- —swap– —–io—- –system– —–cpu—–
r b swpd free buff cache si so bi bo in cs us sy id wa st
0 0 252848 1252264 2449400 20381888 0 0 25 77 3 1 6 2 58 29 0
0 1 252848 1241816 2449408 20381956 0 0 34 148 3102 2892 10 3 84 3 0
0 0 252848 1257000 2449408 20382036 0 0 0 468 1336 1201 3 1 33 58 0
3 0 252848 1243228 2449412 20382332 0 0 140 134 2278 1955 7 2 90 1 0
0 1 252848 1245444 2449420 20382460 0 0 68 304 2558 2255 7 2 40 42 0
1 1 252848 1231920 2449424 20382648 0 0 0 122 1708 1356 4 1 61 28 0

From here we are interested into the pre-last column the wa . From what we see there are all the time some values there, this mean the server is waiting the IO . Now we see that we have some problem.
But here you don’t see anything about what is causing this. You only check and see if you are having IO problem .

Please note, in this result, the sum of columns id (Idle) and wa (Wait IO) is almost 100, this is leading to some problem on configuration . In most of the cases is from ext4 journal.

How to find the cause ?
Well we can check with ps auxf command .

ps auxf |more
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 2 0.0 0.0 0 0 ? S Nov10 0:00 [kthreadd]
root 3 0.0 0.0 0 0 ? S Nov10 1:26 \_ [migration/0]
root 4 0.0 0.0 0 0 ? S Nov10 1:04 \_ [ksoftirqd/0]
root 5 0.0 0.0 0 0 ? S Nov10 0:00 \_ [migration/0]
root 6 0.0 0.0 0 0 ? S Nov10 0:01 \_ [watchdog/0]
root 7 0.0 0.0 0 0 ? S Nov10 0:07 \_ [migration/1]
root 8 0.0 0.0 0 0 ? S Nov10 0:00 \_ [migration/1]
root 9 0.0 0.0 0 0 ? S Nov10 3:33 \_ [ksoftirqd/1]
root 10 0.0 0.0 0 0 ? S Nov10 0:01 \_ [watchdog/1]
root 11 0.0 0.0 0 0 ? S Nov10 0:03 \_ [migration/2]
root 12 0.0 0.0 0 0 ? S Nov10 0:00 \_ [migration/2]
root 13 0.0 0.0 0 0 ? S Nov10 6:11 \_ [ksoftirqd/2]
root 14 0.0 0.0 0 0 ? S Nov10 0:01 \_ [watchdog/2]
root 15 0.0 0.0 0 0 ? S Nov10 0:02 \_ [migration/3]
root 16 0.0 0.0 0 0 ? S Nov10 0:00 \_ [migration/3]

And here we are interested about STAT column .

The stat can have this values:
D Uninterruptible sleep (usually IO)
R Running or runnable (on run queue)
S Interruptible sleep (waiting for an event to complete)
T Stopped, either by a job control signal or because it is being traced.
W paging (not valid since the 2.6.xx kernel)
X dead (should never be seen)
Z Defunct (“zombie”) process, terminated but not reaped by its parent.

Additional characters may be displayed:
< high-priority (not nice to other users) N low-priority (nice to other users) L has pages locked into memory (for real-time and custom IO) s is a session leader l is multi-threaded (using CLONE_THREAD, like NPTL pthreads do) + is in the foreground process group So from here we deduct that if the stat have "D" then is a problem with the process. To cut down process that is "eating" your CPU time, you can use this command which samples all process with D flag in every second: while true; do date; ps auxf | awk ‘{if($8==”D”) print $0;}’; sleep 1; done

Tue Dec 3 13:22:06 CET 2013
Tue Dec 3 13:22:07 CET 2013
Tue Dec 3 13:22:08 CET 2013
Tue Dec 3 13:22:09 CET 2013
Tue Dec 3 13:22:10 CET 2013
root 500 0.0 0.0 0 0 ? D Nov10 2:14 \_ [jbd2/sda6-8]
nobody 14675 0.1 0.1 134932 39620 ? D 13:20 0:00 \_ /usr/local/apache/bin/httpd -k start -DSSL
Tue Dec 3 13:22:11 CET 2013
Tue Dec 3 13:22:12 CET 2013
root 981 0.0 0.0 0 0 ? D Nov10 3:13 \_ [kjournald]
Tue Dec 3 13:22:13 CET 2013
Tue Dec 3 13:22:14 CET 2013

From the result you can see that [jbd2/sda6-8] [kjournald] is creating some problem.

Also you may use iotop or atop to see some stats.

You can check only those process with this command .

while true; do ps auxf | grep D | grep -E “(jbd2\/dm\.*|kdmflush)”; sleep 1; done

Ok, if the problem is related to the ext4 journal I think you should consider to remove that. If your server is on development you don’t need it, also if is in production then you may better use a raid for having your information in good condition.

Regards

Load without reason on centos

Filed under: Linux — Tags: , , — admin @ 1:09 pm

Hello
Well it appear that on a plesk server with only os reloaded we see some load.
I search the raid but it was finished to re sync so no load should be there .
After debugging with iotop I see this
505 be/3 root 0.00 B/s 0.00 B/s 0.00 % 99.99 % [jbd2/md1-8]

After a little search it appear that is from ext4 journaling.

Not to disable ext4 journaling is not so easy because you have to umount the partition, or to be monuted in read only .

After a little search I found out that rsyslog was the problem was hitting the limit, and was writing a lot of information into the log. After disabling the rsyslog everything was back to normal . However I am waiting again the problem to see what pid was causing this.

Any way strange problem .

Regards

November 28, 2013

ubuntu virtualbox networking not working

Filed under: Linux — Tags: , , — admin @ 10:20 am

Hello
Today I wanted to test something on a ubuntu server . So I start a virtualbox with it. However when it started there was no network. But only a error with 60 seconds to wait.
After long wait, the ubuntu server have started, but no network available . I have to mention that I use bridged adapter on virtual server.

The solution is to empty one file.
I did make a backup first with
cp /etc/udev/rules.d/70-persistent-net.rules /root

After this I have empty the file
echo ""> /etc/udev/rules.d/70-persistent-net.rules

And rebooted the server.
After this all was ok.

October 30, 2013

PHP-SOAP Installation on DirectAdmin

Filed under: Linux — admin @ 4:29 pm

New problem on my side. On a DirectAdmin server. First of all I was thinking that it using repository, however I was wrong. The direct admin use a custom build.
So , how to install php-soap on a directadmin server without yum install php-soap ?

Well first of all you can go do build directory :
cd /usr/local/directadmin/custombuild

Here you can see what is the actual configuration with:
./build used_configs

The php file will be I think
/usr/local/directadmin/custombuild/configure/suphp/configure.php5

Now append –enable-soap to the end of the file. Don’t forget to add a “\” to the end of the last line.
Basically you will have something like :

“–enable-mbstring” \
“–with-imap” \
“–with-imap-ssl”

You have to modify it something like

“–enable-mbstring” \
“–with-imap” \
“–with-imap-ssl \”
“–enable-soap”

After this run
./build php all

Regards

October 3, 2013

SSH key-type, rsa, dsa generate

Filed under: Linux — admin @ 9:07 am

Hello
Well if you need to connect using rsa key or dsa is easy to genearte them .
Just run this in directory where you want the output.

ssh-keygen -t rsa -b 4096 -f id_rsa

DSA is faster for signature generation but slower for validation, slower when encrypting but faster when decrypting and security can be considered equivalent compared to an RSA key of equal key length.

You can add also
-C "your_email@example.com"

« Newer PostsOlder Posts »

Powered by WordPress