LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > AIX
User Name
Password
AIX This forum is for the discussion of IBM AIX.
eserver and other IBM related questions are also on topic.

Notices

Reply
 
Thread Tools
Old 11-24-2008, 08:24 PM   #1
pobman
LQ Newbie
 
Registered: Jun 2005
Location: Wellington, New Zealand
Distribution: Fedora 9
Posts: 29
Thanked: 1
cpio archive does not restore directories.


[Log in to get rid of this advertisement]
Hello,

Today I have a new problem that is baffling me when I try to restore my cpio it dumps all the files in what seems one directory.
I was expecting the tape to contain the root file sytem and relative directories, can anyone suggest why the files I recovered

a) Are not in a directory structure as expected.
b) Are missing files such as /etc

I have a tape which contains a cpio backup, it has been created with the following commands

Code:
cd /
find . -print |cpio -ocvBdum >/dev/rmt0
cpio -itcB /dev/rmt0 >/tmp/verify.log 2>/tmp/verify.log
I understand the switches to backup mean:

Code:
o - reads file path names from standard input
c - Reads and writes header information in ASCII character form.
v - Lists file names.
B - Performs block input and output using 512 bytes to a record.
d - Creates directories as needed.
u - Copies unconditionally.
m - Retains previous file modification time.
The switches to Test the backup are:
Code:
-i - command reads from standard input an archive file created by the cpio -o command
c - Reads and writes header information in ASCII character form.
B - Performs block input and output using 512 bytes to a record.
To restore I used:
Code:
cpio -icBvd < /dev/rmt0

Last edited by pobman; 11-24-2008 at 08:37 PM..
pobman is offline     Reply With Quote
Old 11-24-2008, 09:31 PM   #2
AuroraCA
Member
 
Registered: Jul 2008
Location: Northern CA USA
Distribution: Ubuntu, Slackware, Gentoo, Fedora, Red Hat, Puppy Linux
Posts: 370
Thanked: 10
Using the ‘.’ in the find statement will give you more flexibility when doing restores, as it will save file names with a relative path rather than a hard wired, absolute path. I would also add a -depth flag. The -depth option forces ‘find’ to print of the entries in a directory before printing the directory itself. This limits the effects of restrictive directory permissions by printing the directory entries in a directory before the directory name itself.

Create archive:
Code:
cd /
find . -depth -print |cpio -ocvB > /dev/rmt0
Restore archive:
Code:
cd /
cpio -icBvdum < /dev/rmt0
AuroraCA is offline     Reply With Quote

Reply

Bookmarks


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
error: unpacking of archive failed: cpio: read tengun Linux - Software 1 11-10-2007 04:51 PM
CPIO hangs - doesn't extract archive zivota Red Hat 1 04-21-2006 02:58 AM
how to copy-in cpio archive to temp directory jxi Slackware 2 03-08-2006 05:32 PM
How to use cpio to extract a cpio archive? linx win Debian 4 06-17-2005 02:53 PM
rpm install proble--cpio: Archive file not in header mlgill Linux - Newbie 0 07-24-2004 12:53 PM


All times are GMT -5. The time now is 07:08 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration