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 -aAXHv --numeric-ids --info=progress2 --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} / /path/to/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

Previous ArticleNext Article

Leave a Reply

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


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
postqueue -p

Check the postfix version
postconf mail_version

Get default value set on the postfix config
postconf -d

Get non default value set on the postfix config
postconf -n

Flush the mail queuw
postfix flush

Force to send the queue
postqueue -f

Process all emails stuck in the queue
postsuper -r ALL && postqueue -f

Read email from mail queue
postcat -q MAIL_ID

Remove certain mail from mail queue
postsuper -d MAIL_ID

Remove all mail queue
postsuper -d ALL

Fast method to remove mail from queue
find /var/spool/postfix/deferred/ -type f | xargs -n1 basename | xargs -n1 postsuper -d

Remove all the deferred mail in queue
postsuper -d ALL deferred

Sorting email with “from address” filter
postqueue -p | awk '/^[0-9,A-F]/ {print $7}' | sort | uniq -c | sort -n

Remove all email that sent to user@dom.ain
postqueue -p|grep '^[A-Z0-9]'|grep user@dom.ain|cut -f1 -d' '|tr -d \*|postsuper -d -

Remove all email sent from user@dom.ain
postqueue -p|awk '/^[0-9,A-F].*user@dom.ain / {print $1}'|cut -d '!' -f 1|postsuper -d -

Remove all email sent from the dom.ain
postqueue -p | grep '^[A-Z0-9]'|grep @dom.ain|cut -f1 -d' ' |tr -d \*|postsuper -d -

Mail queue stats short
postqueue -p | tail -n 1

Number of emails in Mail queue
postqueue -p | grep -c "^[A-Z0-9]"

Fast count of emails in mail queue
find /var/spool/postfix/deferred -type f | wc -l

Watch Log Live
tail -f /var/log/maillog

Count and sort success pop3/imap logins

grep "\-login"  /var/log/dovecot-info.log |grep "Login:"|awk {'print $7'}|sort|uniq -c|sort -n

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

grep -i "sasl_username"  /var/log/maillog |awk {'print $9'}|sort|uniq -c|sort -n

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

grep -i "sasl_username"  /var/log/maillog |grep "May 18"|awk {'print $9'}|sort|uniq -c|sort -n

Analyze Postfix Logs

pflogsumm /var/log/maillog | less

You may need to install the pflogsumm package first.


Passing LFCS Exam (Re-write)

This December 2019, i have passed the Linux Foundation Certified System (LFCS) Administrator exam. This exam is provided by Linux Foundation Organization. An organization to maintain the open source ecosistem by provide an event, training and certification.

Twitter serve 140 character


For more details, you can visit their site here. For the Lxcf exam, here.
Having prior experience in using Linux/Unix based OS is must. Especially understand how this Operating System works generally and how to use the command line. Most of the question/task in this exam is hands-on Linux command.

For the LFCS Exam, a score of 66% or above must be earned to pass. FAQ for Linux Foundation here.

The number of the question on this exam is slightly different from each person. Seems based on the question/task weight and scoring. In my case, i have about 65-70 question.

The question domain based on my exam is;
– User/group management
– Storage management
– File manipulation
– Other’s command
By the way we can chose 2 distribution for this exam, Cent-OS/Ubuntu.

For this exam, i used the bundle package exam + course with Black Friday coupon 😀 though. But, the course is only general course how the Linux working.