Welcome to WebmasterWorld Guest from 18.204.48.199

Forum Moderators: bakedjake

Message Too Old, No Replies

How to use tar for backing up the entire site...

     
7:36 am on Aug 29, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 2, 2002
posts:1099
votes: 0


Hi, I was wondering how you can use tar command in SSH for backing up files.

I have this in my notepad but SSH rejected.

tar -xvzf backup.tar.gz

8:31 am on Aug 29, 2003 (gmt 0)

Full Member

10+ Year Member

joined:Mar 14, 2002
posts:325
votes: 0


Almost.

$ tar -czvf backup.tar.gz /home/youruser/public_html

or whatever the path should be. First, using -x extracts, not creates a file. Second, you need to specify the path.

Your command is perfect for untarring the resultin file then.

9:11 am on Aug 29, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 2, 2002
posts:1099
votes: 0


Oh okay... thanks... btw, when I entered this command, I got a message 'Broken pipe' Before that, i saw a GIF file...

Do you know what this means?

6:02 pm on Aug 30, 2003 (gmt 0)

Full Member

10+ Year Member

joined:Mar 14, 2002
posts:325
votes: 0


when I entered this command, I got a message 'Broken pipe' Before that, i saw a GIF file...

Maybe your disk is full. Or you're out of memory.Or by some reason it was not possible to complete the command. From a quick googling (paraphrasing a bit):

A broken pipe means one process finished before another. In this case, it
sounds like gzip aborted before tar could complete.

You can try too to do

$ tar -cvf backup.tar /path/to/directory

and do the compressing later.

12:54 am on Sept 1, 2003 (gmt 0)

Junior Member

10+ Year Member

joined:Oct 8, 2002
posts:65
votes: 0


Also, it might spit the dummy if you're trying to tarball a directory which is your cwd (current working directory).

Ie, try creating the tarball of the directory somewhere else...

tar cfvz /home/username/backup.tar.gz /home/username/www

2:10 pm on Sept 1, 2003 (gmt 0)

Preferred Member

10+ Year Member

joined:Oct 4, 2000
posts:446
votes: 0


Perhaps I'm missing something here, but the following is perfectly adequate for me...

tar cvfz - path_to_files > my_files.tar.gz

...though you may be using a different version of tar (this is GNU 1.13.25)

3:53 pm on Sept 1, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 2, 2002
posts:1099
votes: 0


I found out that i need su root access to do this job right. all your commands work flawlessly.

thanks.