• Copy Disk structure for RAID

    April 15, 2014
    Use that command to copy the structure of sda to sdd: sfdisk -d /dev/sda | sfdisk /dev/sdd
  • Add a file to the swap

    April 15, 2014
    Sometimes you can need to add more swap and you can’t change the partitioning of your disk. You can add a file to you swap that we be handle like a disk partition. I recommand to create that file on a ssd disk, because when you server start to swap, it’s not a good side. […]
  • Disk MBR

    April 14, 2014
    Copy MBR between disks: dd if=/dev/sda bs=446 count=1 | dd of=/dev/sdz bs=446 count=1 How to know what bootloader is installed: dd if=/dev/sda bs=446 count=1 2> /dev/null| strings -a
  • Encrypted directory with losetup

    April 14, 2014
    Create a file device: dd if=/dev/zero of=/tmp/crypto.raw bs=1M count=100 Mount Loop device: losetup -e blowfish `losetup -f` /tmp/crypto.raw Format: mkfs.ext3 /dev/loop0 losetup -d /dev/loop0 Mount Loop device: mount -t ext3 /tmp/crypto.raw /mnt/crypto/ -o encryption=blowfish
  • Tcpdump

    April 14, 2014
    Get the last 20 packets exept ssh connections tcpdump -s 0 -n not port ssh -c 20 Get the last 100 http packets and extract hosts tcpdump -s 0 -n -ttt -v -A port 80 -c 100 | grep Host Get the last 100 MySQL queries tcpdump -s 0 -n -ttt -v -A port 3306 […]
  • Sphinx Search

    April 13, 2014
    I use Sphinx to search text in 5 millions records. Mysql is not as good, sphinx is a deticated read only database to search text. The performance are so good, that I use sphinx for everything, even for regular queries. I managed to reduce the load of my servers by a factor of 10 ! […]
  • Memcache

    April 13, 2014
    I was having performace issue in 2008 on my websites, the traffic was getting hight and I had no budget the get more servers. I already used an architecture with squid as a load balancer, and mysql slaves severs. With no budget, I had to find a way to improve the load performace with the […]
  • Perl

    April 13, 2014
    When I need performance and I need to code complicated things, Perl is always my choice. I like the syntax and miss so much map and grep when I’m programing on with other languages. I used perl for every background task like matching millions of records, downloading giga bytes of xml with fork processes, writing […]
  • Php

    April 13, 2014
    I choosed Php to develop websites.I never been a big fan, coming from Perl, but considering alternatives it does the job when you have your own functions and classes. I use php as a template language. Pros: It’s populare It’s mature Easy to find some developers It’s a good couple with Apache Cons: No real […]
  • Mysql

    April 13, 2014
    MySQL is a database wich support master/slave replication system. Lock the database to run a command: FLUSH TABLES WITH READ LOCK; SYSTEM sh -c ‘backup.sh’; UNLOCK TABLES; Pros: The master/slave replication is mature and powerfull Innodb provide good performance on big tables Cons: Can’t find any for my use