LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-29-2004, 02:37 PM   #1
sdebiasio
LQ Newbie
 
Registered: Jul 2004
Posts: 22

Rep: Reputation: 15
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 ...

 
Old 07-29-2004, 02:40 PM   #2
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,275

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
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.
 
Old 07-29-2004, 02:52 PM   #3
sdebiasio
LQ Newbie
 
Registered: Jul 2004
Posts: 22

Original Poster
Rep: Reputation: 15
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.
 
Old 07-29-2004, 03:00 PM   #4
linuxlastslonge
Member
 
Registered: Jun 2002
Location: Franklin, IN
Distribution: Debian, CentOS, Mac OS X
Posts: 158

Rep: Reputation: 30
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
BE SURE YOU ARE IN THE DIRECTORY YOU INTEND TO EXTRACT THE ARCHIVE TO WHEN YOU RUN THE ABOVE COMMAND.


hope this helps!
 
Old 07-30-2004, 09:46 AM   #5
sdebiasio
LQ Newbie
 
Registered: Jul 2004
Posts: 22

Original Poster
Rep: Reputation: 15
Thank you! That worked wonderfully! I appreciate the help.
 
Old 07-30-2004, 10:04 AM   #6
theYinYeti
Senior Member
 
Registered: Jul 2004
Location: France
Distribution: Arch Linux
Posts: 1,897

Rep: Reputation: 61
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
CHMOD directories.sub-directories.files zerojosh Linux - Software 2 11-19-2005 04:22 PM
Searching multiple directories and sub directories for a file jeep99899 Linux - Newbie 2 10-13-2005 01:23 PM
What directories to back-up in for the installation of the upcoming SlackWare 10.2 nasty_daemon Slackware 5 09-13-2005 12:27 PM
K3B won't back up hidden directories racsw Linux - Software 3 11-21-2004 09:12 PM
How do I copy home directories back? G-wizz Linux - Newbie 5 06-11-2004 07:20 AM


All times are GMT -5. The time now is 10:32 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration