book graphic unix and linux troubleshooting guide

My Troubleshooting E-Book will show you how to solve tough problems on Linux and Unix systems!







Using cpio


What is this stuff?

If this isn't exactly what you wanted, please try our Search (there's a LOT of techy and non-techy stuff here about Linux, Unix, Mac OS X and just computers in general!):

Message-ID: <37601D91.A0B559ED@aplawrence.com>
Subject: Re: cpio
References: <19990610160534.07641.00000205@ng-ca1.aol.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit

LoneTar Backup Logo

It sometimes surprises me that people have trouble with cpio. Not that its usage is at all obvious, but the man or info pages are usually packed with multple examples, and a web search will turn up thousands more.

Probably the two most important things to understand is that the normal use of cpio for creating archives is to feed a list of files to its standard input, and send the output to a storage device or a file. So usually you'll be using a program like "find":



find . | cpio -ocv > /tmp/archive.cpio


Becase cpio reads files from stdin in, you can use it interactively:



cpio -ocv > /tmp/archive.cpio


will hang, waiting for you to type file names. Type in pathnames, pressing enter after each one, and finish with a CTRL-D on a line by itself.

For restoration, if you want everything, a simple:



cpio -ivdum  < /tmp/archive.cpio







may be all you need. If you left off " < /tmp/archive.cpio", cpio is just going to sit there and hang, doing nothing.

By the way, that "c" flag in the creation example is supposed to give you compatibility, but it may not: see I can't read a cpio archive created on a Linux box- it fails with "premature end of file". I Used the "c" flag which should give me compatibility..

I often use cpio to copy one directory to a new drive:



cd /data
find . | cpio -pdmv /newdrive/data






ad

Enter your email address for automatic notification of new posts here
(be sure to whitelist 'feedburner.com' if you use spam filtering)

Or use any RSS reader

Delivered by FeedBurner


Views for this page
Today This Week This Month This Year  Overall
191111 3,158

/Bofcusm/55.html copyright 1997-2004 (various authors) All Rights Reserved

Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. We appreciate comments and article submissions.

Publishing your articles here

More:
       - Backup




Unix/Linux Consultants


http://www.vss3.com SCO/Caldera OpenServer, Unixware & Linux. Tarantella & Non-stop Clustering


http://www.breakthru.com.au SCO (Openserver and Unixware), Unix, Solaris and Linux Consulting services including: Secure Networking Solutions; Linux based Firewalls; Backup Solutions; Secure Home to Office Network Setup; Phone, Remote and On-Site Support available - Satisfaction Guaranteed!


SCO, OpenServer, UnixWare, software, servers, security, networks, installation, administration, troubleshooting, maintenance, Watchguard, firewalls, VPNs, e-mail. Visit us at Open Systems Computing and www.go2unix.com.



Twitter
o Daryl McBride says Linux is Unix.. it is, but it's way too late to flog that horse. 9:03 AM May 4th 2008








Change Congress