CPIO Restore

 
Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers CPIO Restore
# 1  
Old 08-26-2016
LINE CPIO Restore

Please note that using the command cpio to back up to tape was successful. Used the below command:
Code:
time find /accts -print | cpio -oa --block-size=512 --format=newc --verbose -O /dev/nst0

I'm trying to restore from tape of a particular file and having issues. Below is the command to restore from tape:
Code:
 cpio -iv "/accts/bank/2day" "/accts/bank/lastyear" --block-size=2048 < /dev/nst0

Please assist if the above command to restore is correct. I tried using it but it does not restore. I was in the /bkp directory to do the restore.

Last edited by vbe; 08-26-2016 at 09:16 AM.. Reason: code tags
# 2  
Old 08-26-2016
Quote:
Originally Posted by isoabv
Please note that using the command cpio to back up to tape was successful. Used the below command:
Code:
time find /accts -print | cpio -oa --block-size=512 --format=newc --verbose -O /dev/nst0

I'm trying to restore from tape of a particular file and having issues. Below is the command to restore from tape:
Code:
 cpio -iv "/accts/bank/2day" "/accts/bank/lastyear" --block-size=2048 < /dev/nst0

Please assist if the above command to restore is correct. I tried using it but it does not restore. I was in the /bkp directory to do the restore.
Using different block sizes when creating a cpio archive and when reading that cpio archive is almost always going to fail.
# 3  
Old 08-27-2016
hi,
i tried as per your request but it came up with an error below
Code:
cpio: read error: Cannot allocate memory

kindly assist.
Moderator's Comments:
Mod Comment Please use CODE tags when displaying sample input, sample output, and code segments.

Last edited by Don Cragun; 08-28-2016 at 12:46 AM.. Reason: Add CODE tags.
# 4  
Old 08-28-2016
Quote:
Originally Posted by isoabv
hi,
i tried as per your request but it came up with an error below

'cpio: read error: Cannot allocate memory'

kindly assist.
I didn't request anything. I suggested that you use the same blocking factor when creating your cpio archive on tape and when trying to read that cpio archive from tape.

You will also need to be sure that you are reading from the same position on the tape as the position where you wrote the tape. On some systems, the device name /dev/nst0 would specify that the tape was to be opened with no rewind.

Note also that since you used absolute pathnames when adding files to the archive, the directory in which you are sitting when restoring those files does not matter.

So, exactly what command did you use when you created your archive and exactly what command did you use when you tried to read files from your archive? And which command gave you the diagnostic? (And, please use CODE tags when displaying all of the above!)

What operating system are you using?

What shell are you using?
This User Gave Thanks to Don Cragun For This Post:
# 5  
Old 08-28-2016
below is how we had archived
Code:
time find /accts -print | cpio -oa --block-size=512 --format=newc --verbose -O /dev/nst0

when restoring we used the below command
Code:
cpio -iv "/accts/bank/2day" "/accts/bank/lastyear" --block-size=512 < /dev/nst0

below is the error while restoring.
Code:
'cpio: read error: Cannot allocate memory

we are logged in as root with bash shell.

OS
Code:
Linux 2.6.9-78.ELsmp #1 SMP 2008 i686 i                                                                               686 i386 GNU/Linux

# 6  
Old 08-29-2016
please assist on the above issue.
# 7  
Old 08-29-2016
I don't use a Linux system, but the standard requires that operands follow options on the command line as in:
Code:
cpio -iv --block-size=512 "/accts/bank/2day" "/accts/bank/lastyear" < /dev/nst0

instead of:
Code:
cpio -iv "/accts/bank/2day" "/accts/bank/lastyear" --block-size=512 < /dev/nst0

And, I still question whether /dev/nst0 is the device name you should be using? Just for the fun of it, try the commands:
Code:
dd if=/dev/st0 of=/dev/null count=1
cpio -itv --block-size=512 < /dev/st0

My suspicion is that you are adding archives to the your tape (without rewinding the tape after you have written an archive) and then reading from an unwritten portion of the tape. But, without knowing what else has been done to that tape device between the cpio command that created the archive and the cpio command that is trying to read the archive, there is no way to know.

The error you are getting is one that I have never seen from cpio before. A read should not require memory allocation. Memory allocation for input buffers should have been done before trying to read anything.
Login or Register to Ask a Question

Previous Thread | Next Thread

8 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. UNIX for Beginners Questions & Answers

Cpio Restore didnt go to plan

Hello folks, one of the RAID drives in our SCO system crashed recently and being hot swap it was replaced. Problem was that on boot it stops at: Checking protected password and protected subsystem databases.... First I did #authck -a and checked /etc/auth/system/ttys as per instructions in a... (7 Replies)
Discussion started by: Redstar
7 Replies

3. UNIX for Dummies Questions & Answers

Unable to restore cpio archive to a directory

Hello Every one, I want to back up all passwd files to /xyz/passfiles.cpio and Then restore them to /abc directory. Here is what I wrote: find / -name passwd | cpio -oc > /tmp/passwd.cpio and to restore cd abc cpio -ium < /tmp/passwd.cpio I can not find the files restored to /abc... (2 Replies)
Discussion started by: drdigital_m
2 Replies

4. UNIX for Dummies Questions & Answers

restore cpio file

Hi, under unix aix , i had to put a catostrophic patch from an editor ... i had first made a cpio backup connected root cd /application find . –print | cpio –ocvBm > /sauvegarde/sauvegarde.cpio Does someone know the command to restore my cpio backup ? thanks in advandce to everyone ... (7 Replies)
Discussion started by: bzh35
7 Replies

5. SCO

cpio Backup and restore to spare server fails

Our company purchased a spare HP ML350 server - identical to current one in use to act as minimal downtime replacement should the inevitable happen. After install of OS 5.0.7 and restore of cpiobackup I get this message: -: Syntax error: Hostname= $inexpected The SCO licence policy... (4 Replies)
Discussion started by: moondogi
4 Replies

6. AIX

mksysb restore - Wrong OS level for restore

Hi all, I am still working on my mksysb restore. My latest issue is during an alt_disk_install from tape I got the following error after all the data had been restored. 0505-143 alt_disk_install: Unable to match mksysb level 5.2.0 with any available boot images. Please correct this... (0 Replies)
Discussion started by: pobman
0 Replies

7. UNIX for Dummies Questions & Answers

Selective restore from a cpio tape archive

Hi, I use following command to restore data from my cpio tape archive: $cpio -icvd < /dev/rct0 But this'll restore all tape contents to the current path, what if I want only selected files from the tape, suppose I want /home/compdir/home2/Rev83/data/PL/01/*.* files to be restored... (8 Replies)
Discussion started by: tayyabq8
8 Replies

8. UNIX for Dummies Questions & Answers

cpio restore - relative pathname

SCO/Caldera Unixware 711 Hi Friends, I have a cpio file which was created using relative pathnames. the relative pathname is users/data/* I want to restore these files to a different directory with cpio. An example restore directory is /home/suresh Is this possible ? Can someone... (4 Replies)
Discussion started by: sureshy
4 Replies
Login or Register to Ask a Question