Solved

tar option

Posted on 2002-06-12
12
614 Views
Last Modified: 2013-12-27
Hi,

I have huge amount of data which has to be backedup on a two tapes using tar command.
How can i run tar so that once the first tape is fulled it has to prompt for second tape, and the rest of the data only has to go inside the second tape.


0
Comment
Question by:msnr
12 Comments
 
LVL 38

Accepted Solution

by:
yuzh earned 100 total points
ID: 7072331
You can do it with tar, use cpio command instead.

do a man cpio to find out the details.

Tell me if you need more help on this

0
 
LVL 38

Expert Comment

by:yuzh
ID: 7072931
Here's some example for using cpio command:

1. To copy file to your tape:

(use find, ls creat a list of files to be copied)

cat list | cpio -oacv -O /dev/rmt/0n

or:

find dir1 dir2 -print | cpio -oacv -O /dev/rmt/0n

(replace /dev/rmt/0n with the real tape device name on your system)

2. To verify what's on the tape:

   cpio -ictv < /dev/rmt/0n

3. To extra files from the tape:
   cd to the dir you want to extra the file to:
   cpio -icdmuv -I /dev/rmt/0n

   Note: cpio can be use for system level backup. since you are using Solaris, use ufsdump & ufsrestore is recommanded for system level backup.

0
 
LVL 4

Expert Comment

by:besky
ID: 7073837
Why do you need to use tar ?
Besides the multivolume problem tar
also has a limit of 155 chars in
the path to a file. This is usually a
problem when used for backups.
(gtar from gnu can solve this one)

ufsdump will create a backup and
prompt you for next volume.

OR depending on the amount of data,
jar has same options as tar but will also
compress files before storing them.

OR you can use cpio, as yuzh pointed out
0
Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

 
LVL 1

Author Comment

by:msnr
ID: 7074663
besky,
i will check ufsdump option, meanwhile will tar prompt
for next volume.?


msnr
0
 
LVL 20

Expert Comment

by:tfewster
ID: 7075948
tar should prompt you when it reaches the end of the tape, e.g.
 .
 .
a /etc/lvmconf/test2.conf 454 blocks
a /etc/lvmconf/test2.conf.old 454 blocks
Tar: end of tape
Tar: to continue, enter device/file name when ready or null string to quit.

After changing the tape, enter the name of the tape device and hit <Enter> to continue (Or give it the name of another tape drive, if you have more than one)

The nice thing about tar is it allows you to transfer datafiles to other Unixes and even NT. But for backups etc. you're better off using cpio of ufsdump.


0
 
LVL 38

Expert Comment

by:yuzh
ID: 7076979
The GUN version of tar works better than the native Solaris tar, it can handle longer path-to-file name and multi-volumes.

You can download it from:
      http://sunfreeware.com/

    tar is handy and good enough for backup regular file, but it have trouble to handle some of the special file such as device file, symbolic link (if you use -h option, tar follow the link and copy the file, it does not keep the symbolic link !).

    Note: I experienced some of application data included device files and symbolic link (eg, micro-eletronic desing simulation result).

0
 

Expert Comment

by:HaynesS
ID: 7093190
MSNR,
   Here is the script (slightly modified for confidentiality) I use to create a hot backup of our systems to a local tape drive.  MAN the UFSDUMP command. Solaris (above 2.4) allows you to name a remote tape drive (not shown here), provided you have access to the remote tape drive (read: .rhosts or /etc/hosts.equiv).  


!/bin/csh
echo ""                                    | tee -a server_fulldump.rpt
echo "::::::::::::::::::::::::::::::::::::::::"      | tee -a server_fulldump.rpt
echo "Level Zero dump of server using"            | tee -a server_fulldump.rpt
echo "server_bkup.csh on"                  | tee -a server_fulldump.rpt
/usr/bin/date                              | tee -a server_fulldump.rpt
echo "::::::::::::::::::::::::::::::::::::::::"      | tee -a server_fulldump.rpt
echo ""                                    | tee -a server_fulldump.rpt
echo ""                                    | tee -a server_fulldump.rpt
echo "Filesystems that'll be saved to tape are:"| tee -a server_fulldump.rpt
echo ""                                    | tee -a server_fulldump.rpt
echo "  1.  / (root) at /dev/rdsk/c0t0d0s0"      | tee -a server_fulldump.rpt
echo ""                                    | tee -a server_fulldump.rpt
echo "  2.  /var at     /dev/rdsk/c0t0d0s3"      | tee -a server_fulldump.rpt
echo ""                                    | tee -a server_fulldump.rpt
echo "  3.  /home at    /dev/rdsk/c0t0d0s6"      | tee -a server_fulldump.rpt
echo ""                                    | tee -a server_fulldump.rpt
echo "  4.  /opt at     /dev/rdsk/c0t0d0s4"      | tee -a server_fulldump.rpt
echo ""                                    | tee -a server_fulldump.rpt
echo "  5.  /home1 at   /dev/rdsk/c0t0d0s5"      | tee -a server_fulldump.rpt
echo ""                                    | tee -a server_fulldump.rpt
echo ""                                    | tee -a server_fulldump.rpt
echo "Starting level 0 using server_bkup.csh:"      | tee -a server_fulldump.rpt
echo ""                                | tee -a server_fulldump.rpt
echo "/ (root) started at"                  | tee -a server_fulldump.rpt
/usr/bin/date                              | tee -a server_fulldump.rpt
/usr/sbin/ufsdump 0cf /dev/rmt/0hn /dev/rdsk/c0t0d0s0
echo ""                                    | tee -a server_fulldump.rpt
echo "/ (root) dump completed at"            | tee -a server_fulldump.rpt
/usr/bin/date                               | tee -a server_fulldump.rpt
echo ""                                    | tee -a server_fulldump.rpt
echo ""                                    | tee -a server_fulldump.rpt
echo "/var started at"                        | tee -a server_fulldump.rpt
/usr/bin/date                              | tee -a server_fulldump.rpt
/usr/sbin/ufsdump 0cf /dev/rmt/0hn /dev/rdsk/c0t0d0s3
echo ""                                    | tee -a server_fulldump.rpt
echo "/var dump completed at"                  | tee -a server_fulldump.rpt
/usr/bin/date                               | tee -a server_fulldump.rpt
echo ""                                    | tee -a server_fulldump.rpt
echo ""                                    | tee -a server_fulldump.rpt
echo "/home started at"                        | tee -a server_fulldump.rpt
/usr/bin/date                              | tee -a server_fulldump.rpt
/usr/sbin/ufsdump 0cf /dev/rmt/0hn /dev/rdsk/c0t0d0s6
echo ""                                    | tee -a server_fulldump.rpt
echo "/home dump completed at"                  | tee -a server_fulldump.rpt
/usr/bin/date                              | tee -a server_fulldump.rpt
echo ""                                    | tee -a server_fulldump.rpt
echo ""                                    | tee -a server_fulldump.rpt
echo "/opt started at"                        | tee -a server_fulldump.rpt
/usr/bin/date                              | tee -a server_fulldump.rpt
/usr/sbin/ufsdump 0cf /dev/rmt/0hn /dev/rdsk/c0t0d0s4
echo ""                                    | tee -a server_fulldump.rpt
echo "/opt dump completed at"                  | tee -a server_fulldump.rpt
/usr/bin/date                              | tee -a server_fulldump.rpt
echo ""                                    | tee -a server_fulldump.rpt
echo ""                                    | tee -a server_fulldump.rpt
echo "/home1 started at"                  | tee -a server_fulldump.rpt
/usr/bin/date                              | tee -a server_fulldump.rpt
/usr/sbin/ufsdump 0cf /dev/rmt/0hn /dev/rdsk/c0t0d0s5
echo ""                                    | tee -a server_fulldump.rpt
echo "/home1 dump completed at"                  | tee -a server_fulldump.rpt
/usr/bin/date                               | tee -a server_fulldump.rpt
echo ""                                    | tee -a server_fulldump.rpt
echo ""                                    | tee -a server_fulldump.rpt
/usr/bin/mt -f /dev/rmt/0 rewoffl
echo ""                                    | tee -a server_fulldump.rpt
echo "Done with server_bkup.csh"            | tee -a server_fulldump.rpt
echo "Remove the tape."                        | tee -a server_fulldump.rpt
echo ""                                     | tee -a server_fulldump.rpt
echo ""                                    | tee -a server_fulldump.rpt


Just cut-n-paste code to a file (server_bkup.csh), modify it to match your partitions (look at disk using the format command and the file /etc/vfstab), ftp it to your machine and set ownership/permissions on the file.

To execute, try this (from the root directory as super-user):

/usr/bin/nohup /server_bkup.csh &

This will run in the background, spool screen output to the file nohup.out, and most importantly, will allow you to close out your login sessions without ending the backup. You will actually get 2 reports from this, the nohup.out report and the server_fulldump.rpt. As a sidebar, do not use the C-shell's built-in nohup command, as it is only as effective as long as the terminal is not closed (if your are working from an xterm, you would not be able to close it).

Cheers,
Stephen
0
 
LVL 20

Expert Comment

by:tfewster
ID: 8003317
No comment has been added lately, so it's time to clean up this Topic Area.
I will leave a recommendation for this question in the Cleanup topic area as follows:

- PAQ, no points refunded

Please leave any comments here within the next 7 days

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

tfewster
Cleanup Volunteer
0
 
LVL 38

Expert Comment

by:yuzh
ID: 8005422
Here are correct solutions for his problem (Not use tar!)
0
 
LVL 20

Expert Comment

by:tfewster
ID: 8005471
yuzh, I agree but there is no obvious "best" answer; cpio & GNU tar do the job and are portable, but ufsdump is preferred for Solaris.

Please make a recommendation on which comment(s) should get points. (Ideally msnr should select the answer that was most helpful to him/her, but that may not happen)
0
 
LVL 38

Expert Comment

by:yuzh
ID: 8005851
cpio will work for any UNIX favour. (it can also handle system level backup
0
 

Expert Comment

by:SpideyMod
ID: 8065965
Answered by yuhz (appears to be the first answer in that works)

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
FTP on FreeBSD server 2 141
Parsing a file using ksh 10 72
How to Change Interface on Cisco IOU 11 111
retrieve nuemaric value from txt file in shell script 3 73
Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question