Best way to back up directories?
Hi - I am wondering what is the best way to do a manual backup of our disk's directories. I tried using the "cp r- " command to copy the live disk (1) to our backup disk (2), but what that seems to do instead is create a brand new backup copy of the directory within the same folder, I have no idea why. All I want to do is overwrite the existing backup with a new backup.
What am I missing here? Thanks in advance ... :confused: |
Hi, and welcome to LQ!
You want: cp -a /your/directory /backup/location -a stands for archive and implies a recursive copy that preserves file permissions and attributes as much as possible. |
Perfect! Thank you so much, that did it.
My next question is -- how do I get rid of the prompting? Because when I'm doing a backup of say, 100 directories, I can't sit there and say "y" to every one of them. Any ideas? Thanks again. |
simply tar everything to a gzipped-tarball and put it on that drive:
Code:
tar -czvf /backup/drive/backup.tgz /directories /to /backup then, if you wish, extract them to the new hdd: Code:
tar -xzvf backup.tgz hope this helps! |
Thank you! That worked wonderfully! I appreciate the help.
|
The surest way I know of copying directories is as follows:
Let's assume you have /usr/local/share, all of which you want to backup under /backup/share. You would do # (cd /usr/local && tar cf - share) | (cd /backup && tar xpf -) Yves. |
All times are GMT -5. The time now is 08:34 PM. |