LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   How to save twice (backup)? (https://www.linuxquestions.org/questions/linux-software-2/how-to-save-twice-backup-401176/)

JZL240I-U 01-09-2006 08:51 AM

How to save twice (backup)?
 
Is there a possibility to save files automatically in two places (e.g. in /home/user/documents on /dev/hda2 and simultaneously in /backup/user/documents on /dev/hdc5)? This should be something like a rule for a directory, like "if you get a new or altered file, copy it to that other location but pronto and no discussion" ;)

I don't want a cron-job or raid but something like a link with two targets. Could one use "tee" with links? But I can't see how that should be set up...

pixellany 01-09-2006 09:02 AM

If I understand hard links correctly, 2 copies of a file are created. but this will not help you if you save a file under a new name.
I think some applications have options to save a backup when saving files (or maybe that's in Windows...;) )
"tee" is not going to work--it is a redirection operator which is used as you are moving data.

I think the only general solution to this is incremental backup run from a cron file.

JZL240I-U 01-09-2006 09:08 AM

Quote:

Originally Posted by pixellany
If I understand hard links correctly, 2 copies of a file are created.

I thought one copy and the original? Or was that what you meant? And one has to know the file name(s) to create the link(s)...

Quote:

Originally Posted by pixellany
...but this will not help you if you save a file under a new name.

Then I want two new files.

Quote:

Originally Posted by pixellany
I think some applications have options to save a backup when saving files (or maybe that's in Windows...;) )

True, but they usually write to the same directory.

Quote:

Originally Posted by pixellany
"tee" is not going to work--it is a redirection operator which is used as you are moving data.

Pity...

Quote:

Originally Posted by pixellany
I think the only general solution to this is incremental backup run from a cron file.

Urghs. That's exactly what I did not want :(.

Lobais 01-09-2006 12:04 PM

There is some tools, that can make two hard disk twins, or what it is called. Anything one filesystem writes, the other disk til write too.
Sadly I can't remember what it is called, but RAID and LVM are different ways of handling the disks. Maybe one of them has the solution.

alunduil 01-09-2006 12:06 PM

If you look around for I believe in google howto raid0 you should come up with something similar to what you are looking for.

Regards,

Alunduil

JZL240I-U 01-11-2006 05:17 AM

Quote:

Originally Posted by JZL240I-U
...I don't want a cron-job or raid but something like a link with two targets. ...

Was what I wrote initially ;). Thanks for your suggestions anyhow -- if I find a solution later, I'll come back and let you know...

JZL240I-U 05-08-2006 03:13 AM

Okay, I caved in ;). I use now rsnapshot and cron, see also http://www.rsnapshot.org/howto/1.2/r...-HOWTO.en.html

uselpa 05-08-2006 04:51 AM

Wouldn't RAID1 be what you want?

JZL240I-U 05-08-2006 05:06 AM

Not really. What I originally wanted, was the immediate backup / duplication of any document edited on the machine (my wife's OpenOffice documents, to be precise), so that in any instant a recovery of the latest version would be possible. It is the same machine I perform my linux experiments on ;) so...

Now I just have to remember to type in "rsnapshot" before I start with something.

IsaacKuo 07-19-2006 08:44 AM

Since you said you were still open to suggestions (in another thread)...

In what way is software RAID-1 not acceptable? It keeps all copies of the partition in sync at all times. Obviously, you want the two+ mirrored partitions to be on different physical drives--preferably on different physical channels.

JZL240I-U 07-19-2006 08:49 AM

Quote:

Originally Posted by IsaacKuo
Since you said you were still open to suggestions (in another thread)...

So I am, as always ;).

Quote:

Originally Posted by IsaacKuo
...Obviously, you want the two+ mirrored partitions to be on different physical drives--preferably on different physical channels.

Yes I do. Is that what RAID-1 does? Then I remembered the RAID scheme the wrong way. I'll have to read up on that. Is it possible to run RAID-1 on disks of differing sizes (e.g. on a 250 GB and a 10GB, with partition-sizes like 2,5 GB)?

Explanation of my erstwhile question: RAID works on whole partitions. I just wanted duplicates of files in /home/<user1> and /home/<user2> plus /root and /NotSuSE/Software and saving of changes in both locations at once. Maybe I just aspired for too small a solution...

uselpa 07-19-2006 08:55 AM

RAID-1 is done on 2 partitions, but they should be the same size, otherwise you'll lose some storage. So if you create two 2,5GB partitions, that'll work fine, regardless of the physical disk size.

JZL240I-U 07-19-2006 09:15 AM

Thanks, uselpa. Just for the "quick and dirty" understanding: If, for example, hda crashes, how can one get access to /hdb4 where the mirrored raid 1 resides? Could I just normally open e.g. /home/user/my/document after seeing an error during boot for hda and handle the problem later?

IsaacKuo 07-19-2006 10:25 AM

Yes, either of the mirrored partitions can be accessed after a crash.

There's no way to specify only mirroring a particular directory, so what you'd want to do instead is:

1. Create a small RAID-1 set of partitions for the desired mirrored data.

2. Mount that RAID-1 set (e.g. /dev/md0) somewhere like /mnt/md0

3. Create one or more subdirectories in /mnt/md0 for the desired backed up directories.

4. Create symbolic links in the "virtual" locations for these directories pointing at the subdirectories within /mnt/md0.

That said, I have had spotty luck with using a symbolic link for a user's home directory. In your case, I'd probably simply mount a RAID-1 partition directly to /home (thus encompasing all users's home directories, other than root).

I can't think of any reason why instant mirroring of root's home directory would be desirable. Theoretically, you shouldn't be doing stuff which affects root's home directory very often, and when you do you more likely want to restore to an older manual backup rather than some semi-corrupted "latest and greatest".

JZL240I-U 07-19-2006 10:31 AM

Quote:

Originally Posted by IsaacKuo
... I can't think of any reason why instant mirroring of root's home directory would be desirable. Theoretically, you shouldn't be doing stuff which affects root's home directory very often, and when you do you more likely want to restore to an older manual backup rather than some semi-corrupted "latest and greatest".

Hm, yeah. An old vice of mine which I might abandon anyhow. I saved some software packets there for easier installation. I do that now at /NotSuSE, but that is no partition ... yet ;).


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