1826176 Members
2355 Online
109691 Solutions
New Discussion

Re: backup

 
SOLVED
Go to solution
O'lnes
Regular Advisor

backup

I want to backup files from different directory ( eg. /usr , /home and /temp ) , can I use ???tar??? to backup the list of file ?
Andy
10 REPLIES 10
Kenneth_19
Trusted Contributor

Re: backup

You can use tar to backup them all in a single command:

# tar -cvf /dev/rmt/0m /usr /home /tmp

In fact, you can name multiple directories in one single tar command.

Regards,
Kenneth
Always take care of your dearest before it is too late
Stefan Farrelly
Honored Contributor

Re: backup

You certainly can - as per the previous reply.

But remember, tar is not a very clever backup program - it does no checking to ensure your file was successfully backed up to tape. Much better to use fbackup - this is HP's recommended tool for backups as it does all sorts of error checking to ensure the integrity of your backup.

Im from Palmerston North, New Zealand, but somehow ended up in London...
Ravi_8
Honored Contributor

Re: backup

Hi,

Very much, you can use tar/cpio/dd.

If you wanted to use tar and backup on tape
#tar cvf /dev/dsk/rmtX /usr /home /tmp

or on to a file
#tar cvf file_name /usr /home /tmp

never give up
O'lnes
Regular Advisor

Re: backup

Thank your suggestion, but if I have 200 files from 50 different directories, can i specify the list in a file?
Andy
Patrick Chim
Trusted Contributor

Re: backup

Hi,

Of course you can do this with tar, just type

tar -cvf /dev/rmt/0m /usr /home /temp .. or
tar -cvf /dir/logfile /usr /home /temp ..

But when you extract the archive it will overwrite the existing path as you use the absolute path to backup the files.

As my opinion, I like to use the relative path to backup the files, just type

cd /
tar -cvf /dev/rmt/0m ./usr ./home ./temp .. or
tar -cvf /dir/logfile ./usr ./home ./temp

When you want to extract the archive you can make a new directory first, then change directory into it and do the extract. Then you will have another copy that will not affect the original one !

Regards,
Patrick
Ravi_8
Honored Contributor

Re: backup

Hi.

You no need to specify all the files in a directory, just specify the directory name.
tar does the backup of all the files in that directory
never give up
O'lnes
Regular Advisor

Re: backup

Thank you all reply, my case is i want to backup the following files:

1./temp/file1
2./temp/file2
3./temp/file3
???
???
4./usr/file1
5./usr/file2
6./usr/file3
???
???
7./home/file1
8./home/file2
9./home/file3
???
???
so i want to specify in a list.
Andy
Patrick Chim
Trusted Contributor
Solution

Re: backup

Hi,

Suppose you have the list named filelist.txt

--> Start
./temp/file1
./temp/file2

..
..
./home/file2
--> End

You can just type
cd /
tar -cvf /dev/rmt/0m `cat /path/filelist.txt`

Regards,
Patrick
Stefan Farrelly
Honored Contributor

Re: backup

Easy to do with fbackup, edit a file and put them in like this;

i /temp/file1
i /temp/file2
i /temp/file3
i /usr/file1
i /usr/file2
i /usr/file3
i /home/file1
i /home/file2
i /home/file3

Then use the command;
fbackup -v -f /dev/rmt/0m -g

Im from Palmerston North, New Zealand, but somehow ended up in London...
O'lnes
Regular Advisor

Re: backup

I tried Patrick's method , it is OK. Thanks.
Andy