Backup

Some data in our computer can’t be lost, the most effective way is backup. This article describe some backup ways I have used. They are: incremental backup web host data, backup web host mysql data, backup Windows data with rsync server, backup Linux data into virtual machine hosted in Windows, using Linux software RAID 1 data redundance scheme .

Incremental backup web host data

For Linux virtual host service, cpanel control system, they provide Security web disk access, but no rsync service. We can mount the web disk, then use rsync incremental backup web data.

I am using root account under Debian Jessie to do this. First install davfs2 “sudo aptitude install davfs2”, create a mount item in “/etc/fstab” like this “https://a.server.com:2123/ /media/webdata davfs noauto,ro 0 0”. Create entry in “/etc/davfs2/secrets” for web disk client access authority like this “/media/webdata username password”, then “sudo chmod 0600 /etc/davfs2/secrets”. Execute “sudo mount /media/webdata” to mount the web disk.

Then, we can use rsync incremental backup web disk files like this “rsync -vzrltopg –delete –progress /media/webdata/html /htmldatabak/”.

Backup web host mysql data
And, we can also backup mysql data when use cpanel control system, first add “ACCESS HOSTS” in “Remote MySQL” menu of Cpanel, for example “1.2.3.4”. Then, we can dump mysql data from this IP machine like this “mysqldump -ha.server.com -udbuser -pdbpassword dbname > dbname.sql”.

Backup Windows data with rsync server
First, you need install a rsync server under Windows, here we choose cwRsync, free edition. Then, if you need authorizing to access Windows rsync server, you need some special setup. For detail see also: Install VNC, SSH, Rsync server on Windows http://www.learndiary.com/en/2013/11/vnc-ssh-rsync-server-on-windows.htm

Backup Linux data into virtual machine hosted in Windows
It seems Windows file system can’t be preserve all the data attribution of Linux data. I simply install a Linux virtual machine in Windows, then use rsync commend in virtual machine to backup another Linux machine data into this virtual machine.

A note about “–exclude” parameter in Rsync command
For example, command line “rsync -avz –exclude ‘f*.txt~’ /home/user/test/source/ /home/user/test/dest/” will exclude any file or directory which match the pattern of ‘f*.txt~’. So, “/home/user/test/source/f1.txt~/2.txt”, the directory “f1.txt~” and all the files and directories(include sub directories recursively) under it will be excluded; and, “/home/user/test/source/f1/f2.txt~”, the file “f2.txt~” will be excluded too. Tested under Debian Jessie.

Using Linux software RAID 1 data redundance scheme
In fact, this is not a backup, but a data redundance scheme mainly used in server. I use two disks create a Linux software RAID 1 partition store the important data, if one disk fail, I can still access data in a degraded RAID 1.

Do you have any other good backup methods? Tell us.

Leave a comment

Your comment

IMPORTANT! To be able to proceed, you need to solve the following simple math (so we know that you are a human) :-)

5 plus 4 equal to?
Please leave these two fields as-is:

蜀ICP备2021012931号-1 川公网安备51092202000377号