Web Hosting Talk







View Full Version : Newbie Backup help


tonys_hiptop
08-05-2004, 03:02 PM
So if I was to use the CP command to backup to a second drive would this work .....

cp -a --target-directory=/backup /home /usr /var /root /etc

where /backup is hdc1, my second drive.

Does this get me what I need and preserve ownership and permissions? A small test looked like the cp -a keeps all the owner and permissions intact. Is this the way to go to protect against drive failure? I could also tar up /home and ftp it to protect against deleted file mistakes by users.

Would this be a reasonable procedure to do on a small server with 40gb drive that's pushing only about 4gb of traffic per month.
Could I do it every night on a cron job?

Suggestions anyone?

leight
08-06-2004, 07:57 AM
Should this really be in the howto section?

Regardless, here is typically what I do.

tar czf /path/to/target.tgz /path/to/source/*

Where the target is generally an NFS mount, or a secondary drive, or in some cases just a normal dir on the same drive, where the resulting tarball is transferred over the network at a later date.

Is this a reasonable procedure?.. Of course, you should always keep backups of important data. Even backups of some not so important data have saved me in the past.

tonys_hiptop
08-08-2004, 09:41 PM
Thanks for the reply. Am I in the wrong spot? I thought "How to" would be right as I want to know "How to" ...

Would you typically add the -p switch to preserve permissions?