Migrate your Linux Server using Rsync

Sometimes we need to move our server to another. Either it’s from on-prem to cloud, vm to vm, or to vps. While migrating we want minimum downtime as we can to the service or systems. Usually, i use rsync to migrate the data and even the OS, so we don’t need to reconfigure the server on the new DC or environment.

To perform that you need to;

  1. Make sure you set up the target VM/server the same as the source.
  2. Setup ssh keyless for root either from or to the target server. You can use rsync to push or pull the data from or to the servers.
  3. Perform rsync dryrun to test your migration. Also, make sure to exclude the specific configuration for the host to avoid conflict or error when you transfer the data. Example;
    rsync -aHAXPn –numeric-ids –exclude={“/boot/*”,”/etc/default/grub”,”/etc/fstab”,”/etc/lvm/*”,”/etc/udev/*”,”/etc/ssh/*”,”/etc/network/interfaces”,”/root/.ssh/*”,”/etc/hostname”,”/etc/hosts”,”/dev/*”,”/proc/*”,”/sys/*”,”/tmp/*”,”/run/*”,”/mnt/*”,”/media/*”,”/lost+found”} old.hostname:/ /
    -n : dry-run
    -another option : please reffer to manual 😛
    * You need to adjust the excluded files based on your OS distribution
    * In this case, we pull the data from the old server to new server.
  4. Perform the initial sync by removing the “-n” from the command above.
  5. For final migration, stop all service on the source server to keep data consistency and avoid data corruption. Then perform step number 4 again.
  6. Now you can try to restart your VM in the new environment or DC. The server supposed to boot normally unless you’ve done something wrong.

Hope this helps you.
Thank You.

My MegaRaid CheatSheat

This is my most used MegaRaid command collection.

A fast command to diagnose the array health status;
MegaCli64 -pdList -a0 | grep -i -E “enclosure|slot|RAW Size|device id|pd type|firmware state|inquiry data”

List the phisical disk;
MegaCli64 -pdList -a0 | grep -i -E “slot|RAW Size|pd type”

List logical drive;
MegaCli64 -LDInfo -Lall -aALL

Locate and blinking your disk in the controler
Start blinking
MegaCli64 -PdLocate -start -physdrv[<ENCLOSURE>:<DRIVE>] -a0
Stop blinking
MegaCli64 -PdLocate -stop -physdrv[<ENCLOSURE><DRIVE>] -a0

To be Continue..

Passing LFCS Exam

On November 28 I am taking the Linux Foundation Certified Linux System administrator exam for the second time. The first one is failed with only 47% point form 66% required to pass. This is a late exam actually, I bought this form cyber Monday discount last year. Fortunately, on the free retake, I am able to pass with an 85% point.
The first take feels like taking a grasp of what all of the performance-based on hands exam looks like. This exam is performed online with a proctor. All the activity during the exam is recorded and shared via the sharing screen by the examschool.local plugin installed as mandatory to take the exam. You will not allow covering your mouth, mouthing, and any suspicious activity during the exam. You are allowed to bring water with a clear glass cup. The exam time is 2 hours with 24 tasks. You can take a break to the restroom but the time will continue to roll.

On this exam the task is structured as:

  • Essential Commands – 25%
  • Operation of Running Systems – 20%
  • User and Group Management – 10%
  • Networking – 12%
  • Service Configuration – 20%
  • Storage Management – 13%

You will instruct to use command for user management, password, permission, access lists, changing the hostname, create lvm, software raid using mdadm, partitioning and grep some content or find files with certain criteria.

All the task is related to a daily administrative task. All the tasks can be achieved by using the manual of the command. I am using apropos to search the keyword for related command to find their man.