Web Hosting Talk







View Full Version : data=writeback & kjournald


JeremyL
01-24-2002, 09:10 PM
A few questions on the same process. I have ext3 running on my server and it's taking up a whole lot of CPU at times due to the constant writing to the disk for email, MySQL database, & logs.

I searched for .journal and found there is a .journal file in each partition on my 2 drives.

/backup/.journal
/home/.journal
/usr/.journal
/var/.journal
/.journal

There are five occurances and each one hase a kjournald process runing constantly when I chaeck "top"

142 root 9 0 0 0 0 SW 3.3 0.0 32:48 kjournald
24340 siriusco 9 0 3076 2700 2144 S 0.7 0.2 0:00 proftpd
141 root 9 0 0 0 0 SW 0.5 0.0 28:27 kjournald
24299 host0711 11 0 1080 1080 820 R 0.5 0.1 0:00 top
32141 named 9 0 6428 4200 2448 S 0.1 0.4 0:23 named
24352 nobody 9 0 9556 8916 8760 S 0.1 0.9 0:00 httpd
24363 nobody 9 0 9556 8916 8760 S 0.1 0.9 0:00 httpd
24364 nobody 9 0 9572 8932 8776 S 0.1 0.9 0:00 httpd
1 root 7 0 508 464 440 S 0.0 0.0 1:20 init
2 root 9 0 0 0 0 SW 0.0 0.0 0:00 keventd
3 root 19 19 0 0 0 SWN 0.0 0.0 8:36 ksoftirqd_CPU0
4 root 9 0 0 0 0 SW 0.0 0.0 7:30 kswapd
5 root 9 0 0 0 0 SW 0.0 0.0 0:00 bdflush
6 root 9 0 0 0 0 SW 0.0 0.0 4:32 kupdated
9 root 9 0 0 0 0 SW 0.0 0.0 0:00 khubd
10 root 9 0 0 0 0 SW 0.0 0.0 25:26 kjournald
139 root 9 0 0 0 0 SW 0.0 0.0 4:34 kjournald
140 root 9 0 0 0 0 SW 0.0 0.0 27:39 kjournald
1154 root 9 0 588 544 488 S 0.0 0.0 0:37 syslogd
1159 root 9 0 1160 500 456 S 0.0 0.0 0:00 klogd
1215 nobody 9 0 2280 1568 1484 S 0.0 0.1 0:13 proftpd
1227 root 9 0 1092 984 912 S 0.0 0.1 0:08 sshd
1248 root 9 0 824 632 632 S 0.0 0.0 0:00 xinetd
1260 root 9 0 1352 1288 1164 S 0.0 0.1 6:40 antirelayd
1363 root 8 0 1096 928 868 S 0.0 0.1 0:07 exim
1377 root 8 0 684 656 616 S 0.0 0.0 0:10 crond
1387 root 9 0 1000 832 832 S 0.0 0.0 0:00 safe_mysqld
1442 mysql 9 0 12524 5584 1848 S 0.0 0.6 0:02 mysqld
1504 root 8 0 596 548 524 S 0.0 0.0 0:00 rhnsd
1537 root 9 0 760 740 644 S 0.0 0.0 0:00 portsentry
1541 root 9 0 760 740 644 S 0.0 0.0 0:00 portsentry
1543 mysql 9 0 12524 5584 1848 S 0.0 0.6 2:01 mysqld

These are always there and the CPU% for each will range from 0 to 3.0 and are always changing but together they add up to larg eloads many times a day for long periods sometimes.

My first question is does each partition need one of these? Or maybe just each disk? If I could cut it down to 2 it would save allot of CPU.

And my second question has to do with ext3 options. I read from http://www.redhat.com/support/wpapers/redhat/ext3/index.html#toc that I can set ext3 to "data=writeback" and i will cut down on the amount of logging and hopefully the CPU usage. But I checked my /etc/fstab file and there is no "data=" anything. I read that webpage and the man pages on mount and can't determine the correct process to get ext3 to use "data=writeback". Do I just need to add that exact text to the end of the /etc/fstab file using pico or do I have to do it with a command line using mount?

Thanks

priyadi
01-25-2002, 01:16 AM
kjournald is a kernel process for ext3 journalling subsystem. You can't kill it, even if you can, you don't want to do it :). Another option for you is to downgrade to ext2. Ext2 is ext3 without journalling, as far as I know, you can use ext2 on ext3 FS and vice versa without significant compatibility problem.

About data=writeback option, you need to append 'data=writeback' after 'defaults', so the field should be like 'defaults,data=writeback', make sure you don't have any spaces between them. And also make sure the entire row is one line. Pico most often will wrap a long lines, you need to make sure it doesn't do that.

JeremyL
01-25-2002, 01:25 AM
My /etc/fstab file currently looks like this


LABEL=/ / ext3 defaults 1 1
LABEL=/backup /backup ext3 defaults 1 2
LABEL=/home /home ext3 defaults,usrquota 1 2
/dev/fd0 /mnt/floppy auto noauto,owner 0 0
LABEL=/usr /usr ext3 defaults,usrquota 1 2
LABEL=/var /var ext3 defaults,usrquota 1 2
none /proc proc defaults 0 0
none /dev/pts devpts gid=5,mode=620 0 0
/dev/hda7 swap swap defaults 0 0
/dev/cdrom /mnt/cdrom iso9660 noauto,owner,kudzu,ro 0 0


So are you saying make it look like this for all 5 partitions?


LABEL=/ / ext3 defaults,data=writeback 1 1
LABEL=/backup /backup ext3 defaults,data=writeback 1 2
LABEL=/home /home ext3 defaults,usrquota,data=writeback 1 2
/dev/fd0 /mnt/floppy auto noauto,owner 0 0
LABEL=/usr /usr ext3 defaults,usrquota,data=writeback 1 2
LABEL=/var /var ext3 defaults,usrquota,data=writeback 1 2
none /proc proc defaults 0 0
none /dev/pts devpts gid=5,mode=620 0 0
/dev/hda7 swap swap defaults 0 0
/dev/cdrom /mnt/cdrom iso9660 noauto,owner,kudzu,ro 0 0


Note the ",usrquota" already in there.

priyadi
01-25-2002, 01:53 AM
Correct. Separate those options by a comma, make sure there are no spaces, and 'default' should always be the first option.

JeremyL
01-26-2002, 07:08 PM
I added the ,data=writeback to the 5 main partitions.

Should I also do it to the other ones like swap and such?


none /proc proc defaults 0 0
/dev/hda7 swap swap defaults 0 0




none /proc proc defaults,data=writeback 0 0
/dev/hda7 swap swap defaults,data=writeback 0 0

priyadi
01-27-2002, 03:11 AM
No, that option only applies to ext3. You can add that to other partition, but I doubt it'll work :).