Cent OS Backup/Restore

Hi All,

I have a VPS runnning Cent OS.  It runs DNS, MySQL, Apache and several other things.

What is the best way to do a full back, including CHMOD settings etc...

Ideally i'd like to make a full backup to a local drive, or to my home PC.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Both rsync and tar have options to preserve permissions and acls.  Even selinux settings.

For the network to have the least amount of overhead due to this activity, you need compressed data stream over the network.  Both tar and rsync do that.  However, with rsync you also get the differential algorithm for incremental backups.  That means that if you run it every day, it would keep track of what you already have and would only backup the new files and the changes in the files.

So with rsync you can use options -az.  I can give you a tar command too.  It is pretty powerful too for using patterns to select or neglect the files and folders you like to backup.
Options with rsync to consider:

-v, --verbose               increase verbosity
-q, --quiet                 suppress non-error messages
-c, --checksum              skip based on checksum, not mod-time & size
-a, --archive               archive mode; equals -rlptgoD (no -H,-A,-X)
-r, --recursive             recurse into directories
-H, --hard-links            preserve hard links
-A, --acls                  preserve ACLs (implies -p)
-X, --xattrs                preserve extended attributes
-x, --one-file-system       don't cross filesystem boundaries
   --exclude=PATTERN       exclude files matching PATTERN
     --exclude-from=FILE     read exclude patterns from FILE
     --include=PATTERN       don't exclude files matching PATTERN
     --include-from=FILE     read include patterns from FILE
-z, --compress              compress file data during the transfer
     --compress-level=NUM    explicitly set compression level

For further details:
Also from the man page:
"Rsync is a fast and extraordinarily versatile file copying tool. It can copy locally, to/from another host over any remote shell, or to/from a remote rsync daemon. It offers a large number of options that control every aspect of its behavior and permit very flexible specification of the set of files to be copied. It is famous for its delta-transfer algorithm, which reduces the amount of data sent over the network by sending only the differences between the source files and the existing files in the destination. Rsync is widely used for backups and mirroring and as an improved copy command for everyday use."
CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

detox1978Author Commented:
Thanks, that sounds very good.

Is there a way to copy it to a windows server or is a mirror, so would need to be the same?
Linux to Linux would have been much easier and better.  However, implementing this on Windows is also possible,
detox1978Author Commented:
Ok, I've decided its easier to get a cheap VPS and sync everything.

What steps do i need to take?
So both the boxes are Linux?

Plan your space on both the boxes.  Commands should not be difficult
detox1978Author Commented:
both boxes are linux - centos.  one 5.6 the other 6.

I have to pay to bandwidth, so would like to keep the sync to a minimum.
With option z, network communication is compressed.
And it doesn't backup files that have already been backed up
detox1978Author Commented:
I've not used it before, could you give me the syntax?
You should have kickstarts for the install so that if there is a system level failure, you can reproduce the same system.

You should backup the config files and other files.  For that you would need a list of paths that need to be transferred.

Syntax example:

rsync -avzA --exclude '*tmp*' /path/to/source/directory  userID@IPADDR:/path/to/target/directory

Open in new window

userID: A user on the remote machine
IPADDR: IP address of the remote machine or fully qualified domain name that is resolvable.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
detox1978Author Commented:
I wanted to do a full backup.  Is there a way to do that?
Yes, but in case of disaster, how would you use the full backup?

One way is to do back ups per partition basis.  In this scenario, you do a kind of minimal install in case of disaster and then overwrite one partition at a time.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux Distributions

From novice to tech pro — start learning today.