Monthly Archives: June 2012

Linux ext4 fs tuning

There is only 3 values affecting mostly affecting io perfomance.
noatime – don`t store file access time
Nodiratime – don`t store disk access time

And turn off journal!
tune2fs -O has_journal -o journal_data_writeback /dev/sdaX
or
data=writeback

my fstab

/dev/md/2 / ext4 noatime,nodiratime 0 0

But thereis no magic… if your have serious io problems – this will not help you. Tuning can give up to 10% perfomance.
usually less.

additional info
http://kerneltrap.org/node/14148

Some mysql howto

This topic was done to skip googling in some cases.

How to get mysql database size:

mysql -uroot -pPASSWORD -D DATABASE_NAME -e "show table status\G"| egrep "(Index|Data)_length" | awk 'BEGIN { rsum = 0 } { rsum += $2 } END { print rsum }'

Source: http://eddnet.org/?p=1765

How to set mysql to read only mode:
Attention! root can do r/w regardless of read_only!

mysql> set GLOBAL read_only = true;

edit config

:/etc/mysql/conf.d# cat slave.cnf
[mysqld]

server-id = 18
innodb_buffer_pool_size = 200MB
read_only = true

How to drop user

DROP USER 'USERNAME'@'%';

How to find duplicate rows.

SELECT *,count(id) AS Num FROM clicks_log GROUP BY id HAVING (COUNT(id) > 1 );

How to delete duplicated Rows
I am not SQL guru, maybe there is another perfect way how to do it, but it`s works:

mysql> create table id_tmp AS (SELECT id FROM block_news_views_log GROUP BY id HAVING (COUNT(id) > 1) ) ;
mysql> DELETE  FROM block_news_views_log WHERE ( id IN (SELECT * from id_tmp ) );
mysql> DROP table id_tmp;
mysql> SELECT id FROM block_news_views_log GROUP BY id HAVING (COUNT(id) > 1) ;

Ubuntu 12 USB monitor Display Link

Finally we have
xserver-xorg-video-displaylink I`ll try to run third monitor 🙂
But it gives Green Screen 🙁
Damn, not working.