PDA

View Full Version : tar -clf : backing up a directory


nonner
1-28-03, 02:42 PM
Hi All,
Has anyone backed up directories and it's content? How do you do it?

I've been using an html shell program to gain shell access for some housekeeping tasks. I have a need to backup a large directory so I can delete it.

Problem I get process killed! Seems to be a timeout issue cause it's a big directory I think??. The resulting tar file is 32meg+ but it's currupt because of the killed process.

here's my command:

For example, to archive a directory named "project", I use the commands below:


cd project
tar clf - . | compress > ../project.tar.Z
cd ..
rm -r project (-r removes all subdirectories, it stands for recursive)

Note that we are saving the archive in the parent directory (../project.tar.Z) so that `tar' won't try to archive its own archive!!. Also, note that, once archived, the original directory is removed.

to UNTAR and install all subdirectories I use:

tar -zxvf [filename with all extensions]

Any help is appreciated,

nonner

nonner
1-28-03, 03:16 PM
Oh well, silly me I forgot to search posts regarding this topic. searching for word tar I found my answer:

/usr/bin/tar -cvpf /www/?/sitename/htdocs/tar-name.tar /www/?/sitename/htdocs/name-of-directory-to-be-backed-up

this tar's with command tar -cvpf
and places tar in /www/?/sitename/htdocs/tar-name.tar
and backed up the directory
/www/?/sitename/htdocs/name-of-directory-to-be-backed-up
to back up your whole site use
/www/?/sitename/htdocs

Powweb suggest doing this using cron or on off hours as it takes away processing time from other users. Consider this when using cpu intensive processes.

My tar file size is 126meg.
When I tried to gzip it that process was killed.

/usr/bin/gzip /www/?/sitename/tar-name.tar

Anyone know how I can gzip or reduce the file size of this tar file?

regards,

nonner

kanwulf
1-28-03, 07:06 PM
/usr/bin/tar czf www/u/username/path/to/directory/filename.tar.gz /www/u/username/path/to/directory |

hammondhill
1-28-03, 07:07 PM
A few days ago I compiled the man pages for gzip and tar and also made a guide on how to tar and gzip files. You can view the man pages here (http://zachery.us/unix/TAR_AND_GZIP_HELP.pdf) and the guide I made here (http://zachery.us/unix/HOW_TO_CREATE_AND_UNPACK_TAR_AND_GZIP_FILES.pdf).

Hope this helps!

nonner
1-30-03, 04:21 PM
Thanks for the man pages. Much appreciated.

hammondhill
1-30-03, 05:27 PM
Glad they were of help to you. Don't thank me, thank the people who made the man pages ;).