Sunday, August 21, 2016
Friday, August 19, 2016
How to Use Rsync to Sync New or Changed/Modified Files in Linux
How to Use Rsync to Sync New or Changed/Modified Files in Linux
by Aaron Kili | Published: August 19, 2016 | Last Updated: August 19, 2016
Download Your Free eBooks NOW - 10 Free Linux eBooks for Administrators | 4 Free Shell Scripting eBooks
As a system administrator or Linux power user, you may have probably come across or even on several occasions, used the versatile Linux Rsync tool, which enables users to expeditiously copy or synchronize files locally and remotely. It is as well a great tool popularly used for backup operations and mirroring.
Some of its eminent features and advantages include; it is exceptionally versatile in that, it can copy locally, to/from a remote shell or remote rsync, it is also remarkably flexible, allowing users to specify any number of files to copy.
One imperative differential of rsync in comparison to other file-coying commands in Linux is its use of the remote-update protocol, to transfer only the difference between files or directory content.
Therefore, in this article, we shall examine how rsync can help us only sync new or changed files or directory content while making backups and beyond in Linux.
To start with, you need remember that the conventional and simplest form of using rsync is as follows:
You can run through the
Most importantly, you can as well share your view on the examples we have covered here or even better still, offer us valuable tips on using this vital command line tool through the comment section below.
Some of its eminent features and advantages include; it is exceptionally versatile in that, it can copy locally, to/from a remote shell or remote rsync, it is also remarkably flexible, allowing users to specify any number of files to copy.
Suggested Read: 10 Practical Examples of Rsync Command in Linux
Furthermore, it permits copying of links, devices, file or directory owner, groups and the permissions. It also supports usage without root privileges coupled with many more.One imperative differential of rsync in comparison to other file-coying commands in Linux is its use of the remote-update protocol, to transfer only the difference between files or directory content.
To start with, you need remember that the conventional and simplest form of using rsync is as follows:
# rsync options source destinationThat said, let us dive into some examples to uncover how the concept above actually works.
Syncing Files Locally Using Rsync
Using the command below, am able to copy files from my Documents directory to /tmp/documents directory locally:$ rsync -av Documents/* /tmp/documentsIn the command above, the option:
-a
– means archive mode-v
– means verbose, showing details of ongoing operations
$ rsync -av Documents/* /tmp/documentsAs you can observe and notice from the output of the command, only the new file is copied to the destination directory.
Suggested Read: How to Sync Two Apache Web Servers/Websites Using Rsync
The --update
or -u
option allows rsync to skip files that are still new in the destination directory, and one important option, --dry-run
or -n
enables us to execute a test operation without making any changes. It shows us what files are to be copied.$ rsync -aunv Documents/* /tmp/documentsAfter executing a test run, we can then do away with the
-n
and perform a real operation:$ rsync -auv Documents/* /tmp/documents
Syncing Files From Local to Remote Linux
In the example below, I am copying files from my local machine to a remote sever with the IP address – 10.42.1.5. So as to only sync new files on the local machine, that do not exist on the remote machine, we can include the--ignore-existing
option:$ rsync -av --ignore-existing Documents/* aaronkilik@10.42.1.5:~/all/Subsequently, to sync only updated or modified files on the remote machine that have changed on the local machine, we can perform a dry run before copying files as below:
$ rsync -av --dry-run --update Documents/* aaronkilik@10.42.1.5:~/all/ $ rsync -av --update Documents/* aaronkilik@10.42.1.5:~/all/To update existing files and prevent creation of new files in the destination, we utilize the
--existing
option.You can run through the
rsync man
page to discover additionally useful options for advanced usage, as I had mentioned earlier on, rsync is a very powerful and versatile Linux tool and many System Administrator and Linux power users know just how advantageous it is.Most importantly, you can as well share your view on the examples we have covered here or even better still, offer us valuable tips on using this vital command line tool through the comment section below.
Sunday, August 14, 2016
Migrating VMWARE Image (OVA) to RHEV 3.5 as a VM
I would like to share with you this secret way of migrating any VM from any hypervisor to RHEV. Red Hat has not mentioned this anywhere on the internet so I would recommend you to do this only on test environments:
1) Extract the OVA image using: tar xvf CFusion-server.ova
2) Convert the extracted VMDK disk file to raw lvm image using: qemu-img convert -f vmdk CFusion-server-disk1.vmdk -O raw CFusion-server-disk1.img
3) SCP the image (.img file) to you NFS exports server (also, Check the VM size)
4) In RHEVM, create a VM with same sized disk (preallocated)
5) Export that VM (to export NFS) and delete the newly created VM
6) Check the export VM image in images folder on NFS export location
7) Put export in maintenance mode and on nfs server, use dd command to write the main exported disk file under images folder
8) Now, activate the export again
9) Create a VM with THIN disk from exported image
You can see that VM is ready for its first run!
Subscribe to:
Posts (Atom)