This time is about using rsync to copy a Linux/Unix system to another host or backing it up. By using rsync, its more effective than using tool like dd since we can efficiently select the directory, attribute that we we want to backup or move.

Sometime ignorance is a blessing

The one who not so wise

rsync also can be use when the system is running. But you may need to do it with caution and make sure you understand the data state. When rsync with the system running, the data that have not commit the changes in files level may not transfer.

This method is work for migrating the the system to another hosts. Please be aware, that the target is the fresh installed operating system with the same version of the source.

Rsync full backup

Rsync Clone

  • –numeric-ids, will disable mapping of user and group names; instead, numeric group and user IDs will be transfered. This is useful when backing up over SSH or when using a live system to backup different system disk.
  • –info=progress2,  will show the overall progress info and transfer speed instead of the list of files being transferred.
  • avoid crossing a filesystem boundary when recursing, add the option -x/–one-file-system. This will prevent backing up any mount point in the hierarchy.
  • -n or known as the option for the dry-run. To simulate the file transfers

Tips:

When migrating operating system using rsync, we may need to make sure that the migration have a low downtime impact on the server/service. Make sure you perform inital rsyn using above command in “Rsync full backup”. Then at the final migration, stop all service on the source server/vm then perfom the same command again.

To avoid saturated network performance when transfering the you can use option to have a speed limit in the transfer  –bwlimit= [In KBytes]

Previous ArticleNext Article
Linux System Administrator

Leave a Reply

Your email address will not be published. Required fields are marked *

D.

DDOS and Flooding Detection Apache Webserver (Updated)

List the the connection status and sort to identify attack source

netstat -ntu | awk ‘{print $5}’ | cut -d: -f1 | sort | uniq -c | sort -n

Based on port

Get basic information on which IPs accesses Apache / Nginx the most using shell command

There is a way using standard shell tools, to get some basic information on which IP accesses the webserver the most with:

Or if you want to keep it refreshing periodically every few seconds run it through watch command:

Monitor POST / GET / HEAD requests number in access.log :

Install (D)DosDeflate
Great software, rock solid, and plays nice with either APF or iptables. Install and configure the service in seconds using the commands below. Edit the .conf file to utilize whichever flavor of firewall you’d like to integrate it with. Set a few configuration settings and you’re done.
To Install (D)DosDeflate:
wget http://www.inetbase.com/scripts/ddos/install.sh
chmod 0700 install.sh
./install.sh
If it doesnt workout, its simple to uninstall too. To uninstall:
wget http://www.inetbase.com/scripts/ddos/uninstall.ddos
chmod 0700 uninstall.ddos
./uninstall.ddos

Or we can utilize and tune the value in sysctl.conf.

P.

Postifx Command Cheatsheet

List of helpfull command that used to help me when maintaining Postfix mailserver.

Hemat Pangkal Kaya

Insignificant one

List mail queue and MAIL_ID’s, list mail queue


Check the postfix version

Get default value set on the postfix config

Get non default value set on the postfix config

Flush the mail queuw

Force to send the queue

Process all emails stuck in the queue

Read email from mail queue

Remove certain mail from mail queue

Remove all mail queue

Fast method to remove mail from queue

Remove all the deferred mail in queue

Sorting email with “from address” filter

Remove all email that sent to [email protected]

Remove all email sent from [email protected]

Remove all email sent from the dom.ain

Mail queue stats short

Number of emails in Mail queue

Fast count of emails in mail queue

Watch Log Live

Count and sort success pop3/imap logins

Count and sort success SMTP postfix logins. This is usefull when you want to track a compromised account.

Count and sort success SMTP postfix logins on exact date “May 18”

Analyze Postfix Logs

You may need to install the pflogsumm package first.