Will cpio span tapes ?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Will cpio span tapes ?
# 1  
Old 01-10-2006
Will cpio span tapes ?

Hi. I am very new to the unix world, although not to computers in general (i'm a DBA). We have some procedure here for backup files from the filesystem to tape, on which they chose cpio to back it up. What they do is similar to this:

ls /dirname/ | cpio -ov -O/dev/ntape/tape0

But since files have grew to more than 10GB in size on /dirname/ ( we use 8GB tapes ), there seem to be a problem, allthough I haven't determined whether or not is cpio causing it. So, my question to you all is, will cpio span tapes files (like tar for example) in case there's no sufficient storage to backup all files ?

Thank you very much.
# 2  
Old 01-10-2006
cpio -- Copy File Archives In and Out

cpio stands for "copy in, copy out" and is used to copy data from one location to another. There are several advantages to using cpio over other

UNIX utilities:

1) cpio can back up and restore individual files, not just whole file systems.
2) File header information on files created by cpio is smaller, resulting in smaller-sized backups.
3) Unlike tar, which is limited to a single tape device, cpio can span multiple tapes.

cpio operates in three modes: copy-out ( cpio -o), copy-in ( cpio -i), and pass mode ( cpio -p), which is used to copy files from one location to another on disk and not tape. The following section lists several commonly used options.

cpio Command Options

These options apply to copy-out and copy-in modes, unless otherwise noted.

-c: Write header information in ASCII format, for portability.
-d: Create as many directories as needed.
-v: Verbose (report the names of the files as they are processed).
-V: Same as the preceding, except a "." is printed for each file copied.
-u: Use for an unconditional copy; old files will not replace newer versions.
-m: Retain the previous file modification time. This option will not work on directories being copied.


To copy a directory and its subdirectories to tape, use the following example:

% ls -R | cpio -oVc > /dev/rmt/0

The previous example will copy the directory that you are currently in -- along with all subdirectories within it -- to a tape device located at /dev/rmt/0. The -o specifies that we are in copy-out mode. The -V option is for verbose and will display dots as a progress indicator. The -c option create an ASCII header file.

To copy from tape back to a directory, use the following example:

% cpio -icvD < /dev/rmt/0

In the preceding example, our command will use several options to restore the contents of data on the tape. The -i option puts us in copy-in mode. The -d option creates all the directories needed as it copies the data back.

Backing Up Files With cpio (Copy-Out Mode)

There are several ways to back up files with cpio. I'll cover two of them here in the article.


% cpio -ov list > /dev/rmt/0This command reads from the file "list" and copies them over to a tape device.


% cpio -o /dev/rmt/0This command will allow you to specify files to be backed up. After you are finished entering file names, hit Ctrl+D to execute the command. Here's an example:

% cpio -o > /dev/rmt/0
filename.txt
file1name.txt

Restoring Files With cpio (Copy-In Mode)

The restore process with cpio is similar to backing up files. Instead of the -o for copy-out, we use the -i mode to copy back in from tape.


% cpio -icvum < /dev/rmt/0This example utilizes similar options used earlier, as well as the -m option, which will preserve file modification times.

Use the following example to view a list of contents on the tape archive:
% cpio -ict < /dev/rmt/0Pass Mode

Pass mode can be used to copy directories on a disk device. It will not work against a tape. cpio is preferred over cp when copying files and directories because it preserves ownership and modification times.

The following example copies all files and directories to a directory called bkup:

% ls * | cpio -pdumv bkup
# 3  
Old 01-11-2006
Allright, I'm sorry to said that I already read that :-S .. the problem might be another then. It is strange, but I remember doing a tar the other day when it asked for another tape when it was fill. Could that be possible ?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Cpio - input files (from list) are stored in different order inside cpio archive - why?

Due to budget constraints I have to reinvent an Enterprise backup system in a SPARC (sun4v) Solaris estate (10 & 11). (yep - reinvent wheel, fun but time consuming. Is this wise?! :confused: ) For each filesystem of interest, to try to capture a 'catalog' at the front of each cpio archive (for... (1 Reply)
Discussion started by: am115998
1 Replies

2. Shell Programming and Scripting

Combine logs span across multiple lines

Hi All, I am having a log file ERROR 2016-12-08 10:22:23.542 some data **** some data****** **** some data****** **** some data****** DEBUG 2016-12-08 10:23:23.542 some data **** some data****** **** some data****** **** some data****** when i grep the log file with ERROR am getting... (3 Replies)
Discussion started by: mohanalakshmi
3 Replies

3. Shell Programming and Scripting

select the lines in between some time span

Hi Everyone ! i want to take all the lines from a file that falls in between some date... and every line in a file has a time stamp.. ---some text---- 01/Jan/2010 ---- some other text ---- ---some text---- 10/Jan/2010 ---- some other text ---- ---some text---- 20/Dec/2010 ---- some... (3 Replies)
Discussion started by: me_newbie
3 Replies

4. UNIX for Dummies Questions & Answers

Extracting a Time Span from Syslog Messages File

Hi all, I need your help to explain how I can extract a time span from the syslog messages file on a Solaris 10 system. Here is an example extract of the syslog messages: Dec 4 11:51:38 hajap141-0107.nls.jlrint.com 267938: Dec 4 11:51:36: %DOT11-6-DISASSOC: Interface Dot11Radio0,... (4 Replies)
Discussion started by: wthomas
4 Replies

5. Filesystems, Disks and Memory

Life span of HDD - maximum reads/writes etc

Hi All I was wondering how the copying of vast amounts of data affected the overall lifespan of an HDD. In my example, I'm copying approx 120GB (250,000) of files, once per hour from disk to another. Is this likely to have a detrimental effect on the disk in terms of reads/writes etc? ... (2 Replies)
Discussion started by: huskie69
2 Replies

6. UNIX for Dummies Questions & Answers

Ubuntu Hardy: How to span windows over more than 1 screen?

Hi, Ive 3 screens, 2 nvidia graphiccards and all works fine with the nvidia binary driver and xinerama. I can maximize all windows an one screen, but now i need to span it over all 3 screens. Any ideas? thanks in advance. (3 Replies)
Discussion started by: mcW
3 Replies

7. UNIX for Dummies Questions & Answers

Need help to understand cpio and no rewind tapes

SCO openserver 5r5 I only have this available to me ... To list the files... cpio -itcvB < /dev/nrct0 To copy a file out cpio -icvdBum filename < /dev/nrct0So cpio is to archive or "zip" files up?? and /dev/nrct0 is the tape drive ??? How can i list all the files inside... (2 Replies)
Discussion started by: khaos83_2000
2 Replies

8. AIX

How to ristrict tar to span multi volume of 1.95 gig each.

Can some one help me to know how I can restrict tar to span on multiple volumes if it get bigger then 2 gig. I am working on AIX 5.2 and created a tar of 4 gig but I want to move the tar to 4.3 that has limit of 2 gig. Thanks. (0 Replies)
Discussion started by: interim05
0 Replies

9. UNIX for Dummies Questions & Answers

process Span by shell

is it possible to find which commnands make shell to Span a child process? if so what is the determining criteria?? thanks (4 Replies)
Discussion started by: compbug
4 Replies

10. Shell Programming and Scripting

span of variable

Hi all, I am having a hard time in determining this. I have a shell script, in which I build a variable in a certain format (-i 'x x.in x.out' -i 'y y.in y.out' -i 'z z.in z.out) within a while loop. But that variable is getting lost if I read it after the while loop is ended. I tried "export"..,... (3 Replies)
Discussion started by: ttshell
3 Replies
Login or Register to Ask a Question