LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 11-08-2011, 01:27 PM   #1
Xeratul
Senior Member
 
Registered: Jun 2006
Location: UNIX
Distribution: FreeBSD
Posts: 2,657

Rep: Reputation: 255Reputation: 255Reputation: 255
Backup regularly the /home?


Hello,

I have a very simple question, which is actually a pretty difficult one.

It has lot of dependencies if you know what I mean

For the moment, I use. I dont like it much because rsync could be deleting the deleted files of the real /home. However rsync could fail time to time, I have experienced.

Code:
0 0     * * 5   root    cd ; touch /forcefsck
0 0     * * 5   root    cd /root ; cp -r /home /mnt/backup

I would like to avoid RAID + to have a simple way.

Code:
> cp -r -u  /home /mnt/backup   # could work but unreliable
> the rsync way                 # sometimes it can fail with persmissions (e.g. some weird cases), less reliable
> others ?
Any input would be helpful

Thank you !!!!!
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 11-08-2011, 01:30 PM   #2
jeewiz
LQ Newbie
 
Registered: Jan 2007
Distribution: CentOS 6.5
Posts: 21

Rep: Reputation: 0
I would tar it up and apply a date stamp...

Code:
DATE=`date +%...`
tar -czpf home_backup_$DATE.tgz /home
 
Old 11-08-2011, 01:34 PM   #3
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
Quote:
Originally Posted by Xeratul View Post
For the moment, I use. I dont like it much because rsync could be deleting the deleted files of the real /home. However rsync could fail time to time, I have experienced.
rsync will only delete files if you specify one of the delete options. Never had problems with that.
Quote:
> the rsync way # sometimes it can fail with persmissions (e.g. some weird cases), less reliable
I see it only have problems when you copy files to a filesystem that doesn't support Unix file permissions, like FAT or NTFS.

Quote:
I would like to avoid RAID
RAID is in no way a backup solution, its intention is to keep downtimes short in case of hardware failure.

Quote:
> cp -r -u /home /mnt/backup # could work but unreliable
Why do you think that this is unreliable?

Quote:
> others ?
There are some programs for that (came up with that after a short websearch), but I prefer rsync and it never has failed for me.
 
Old 11-08-2011, 08:26 PM   #4
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
Quote:
Originally Posted by TobiSGD View Post
but I prefer rsync and it never has failed for me.
+1

Using USB hard disks for complete disk mirroring. A real no-brainer.
On critical machines I make a daily backup, but swap the USB disk with one off-site weekly.

jlinkels
 
Old 11-09-2011, 12:35 AM   #5
d3vrandom
Member
 
Registered: Jun 2006
Location: Karachi, Pakistan
Distribution: OpenSUSE, CentOS, Debian
Posts: 59

Rep: Reputation: 9
Use rsnapshot instead of just rsync. Rsnapshot is a collection of perl scripts that allows you to maintain incremental backups spanning multiple time periods using rsync. This way you can have daily, weekly, and monthly backups. It uses symbolic links extensively so disk space usage is minimized. I wrote a guide on how to use rsnapshot if you are interested.
 
2 members found this post helpful.
Old 11-10-2011, 06:11 AM   #6
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
I am not sure yet I want anything else but a verbatim copy of my data, but OTOH being able to roll back changes is valuable as well. Without using a tape rotation scheme. It has happened before that I overwrote my backup before I restored files from something stupid I did. I am going to look in it further. Thanks for posting.

jlinkels
 
Old 11-10-2011, 11:09 PM   #7
d3vrandom
Member
 
Registered: Jun 2006
Location: Karachi, Pakistan
Distribution: OpenSUSE, CentOS, Debian
Posts: 59

Rep: Reputation: 9
Just want to add that the if you use rsnapshot you won't have to worry about what happens if a backup fails. In such an event two things will happen:

- Cron will inform you that the backup failed
- The next time rsnapshot runs it will automatically roll over the failed backup. That is it will delete it and go back to the last successful backup.

So you won't loose backups just because the power went out or something like that.
 
Old 11-10-2011, 11:12 PM   #8
d3vrandom
Member
 
Registered: Jun 2006
Location: Karachi, Pakistan
Distribution: OpenSUSE, CentOS, Debian
Posts: 59

Rep: Reputation: 9
And BTW the snapshots rsnapshot makes are copies. You can copy them back to your home directory or anywhere else using cp:

Code:
cp -rp daily.0/home/user/* /home/user/
 
Old 11-13-2011, 04:09 AM   #9
Xeratul
Senior Member
 
Registered: Jun 2006
Location: UNIX
Distribution: FreeBSD
Posts: 2,657

Original Poster
Rep: Reputation: 255Reputation: 255Reputation: 255
Quote:
Originally Posted by d3vrandom View Post
And BTW the snapshots rsnapshot makes are copies. You can copy them back to your home directory or anywhere else using cp:

Code:
cp -rp daily.0/home/user/* /home/user/
cp -rd does delete the target if files are not existing anymore on the source?

rsync sometimes miss files, and does not like fat32, and sometimes is not so accurate

what would be the alternatives to rsync that would work better with --delete option like?
 
Old 11-14-2011, 12:54 AM   #10
d3vrandom
Member
 
Registered: Jun 2006
Location: Karachi, Pakistan
Distribution: OpenSUSE, CentOS, Debian
Posts: 59

Rep: Reputation: 9
Quote:
Originally Posted by Xeratul View Post
cp -rd does delete the target if files are not existing anymore on the source?

rsync sometimes miss files, and does not like fat32, and sometimes is not so accurate

what would be the alternatives to rsync that would work better with --delete option like?
I wrote cp -rp not rd. And that is for restoring from the backup. Anyway because you have multiple incremental backups the --delete option is not a problem. For example say you have rsync running and you have it setup as follows:

7 daily backups - daily.0- daily.6
4 weekly backups - weekly.0 - weekly.3
3 monthly backups - monthly.0 - monthly.2

So you now have backups that go back 3 months. If you delete a file and a backup is made only your latest backup is spoiled i.e. daily.0. You can still recover the file from backups daily.1-6 and any of the weekly or monthly backups.

Anyway if you don't like rsync you can always use tar or some other method. It's entirely your choice.
 
Old 11-14-2011, 06:32 AM   #11
lithos
Senior Member
 
Registered: Jan 2010
Location: SI : 45.9531, 15.4894
Distribution: CentOS, OpenNA/Trustix, testing desktop openSuse 12.1 /Cinnamon/KDE4.8
Posts: 1,144

Rep: Reputation: 217Reputation: 217Reputation: 217
I could give you some reading for backup with TAR here
if you want this solution
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How do you create a cron file that will regularly perform a level 0 backup once per month? cadre41 Linux - Newbie 2 03-04-2011 10:44 AM
Backup Subversion server regularly - Methods? Gavin Harper Linux - Server 2 01-14-2011 11:45 AM
How to Backup /home budbaker44 Linux - Newbie 3 10-07-2009 01:25 AM
tool to clone my hd regularly for backup reasons xomic Linux - Software 2 05-30-2007 04:18 PM
Backup my home dir ernesto_cgf Linux - General 5 03-27-2007 02:41 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 01:54 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration