Solved

tar option

Posted on 2002-06-12
12
598 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
 
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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

705 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now