LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-21-2006, 10:07 PM   #1
madhugp
LQ Newbie
 
Registered: May 2006
Posts: 20

Rep: Reputation: 0
how to append files using cpio?


hello friend,
I am using redhat linux 9
using
'find . -print|cpio -oB >/dev/dat'
i am taking back up daily from a directory.
but I am not able to append the new files
to the existing cpio back of my catridge.
i tried using -A option also. but no use.

give any idea.
 
Old 12-22-2006, 03:01 PM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,075
Blog Entries: 14

Rep: Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251
You can't really append to the end of a cpio archive but I suspect what you're really after is how to add multiple cpio archives to the same tape.

The answer is you have to be sure to use the "no rewind" device" and use the mt command to go forward on the tape to the next mark.

I don't have the dat on any of my systems so don't know what the "no rewind" device would be for "/dev/dat". I'm used to seeing "/dev/st# for the tape device (0 being first one, 1 the second etc...) and "/dev/nst#" being the equivalent "no rewind" device.

It may be /dev/dat is linked to one of these /dev/st# devices (or has the same major/minor). You may even have a /dev/ndat for "no rewind".

Do ls -l /dev/*dat* to see what you have. If only /dev/dat check to see if it is a symbolic link. If not check to see it's major/minor numbers - they're in the position where the byte count would be for a regular file. Then do ls -l /dev |grep "major minor" to see if anything else has the same major minor (e.g. one of the st# files). If so the equivalent no rewind could be used.

Essentially with the no rewind with a new tape you put it in and do the first backup. The next backup you write would go after that one and so on. To review the backups you rewind the tape and step through it with the mt command:
mt -t /dev/<tape drive> rewind <-- Rewinds to first position
mt -t /dev/<tape drive> fsf <-- Steps to next position
 
Old 01-02-2007, 06:45 AM   #3
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE 42.1_64+Tumbleweed-KDE, Mint 17.3
Posts: 4,065

Rep: Reputation: Disabled
I've no real clue, but what about

'find . -print|cpio -oB >>/dev/dat'

?
 
Old 01-02-2007, 03:43 PM   #4
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,075
Blog Entries: 14

Rep: Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251
Quote:
Originally Posted by JZL240I-U
I've no real clue, but what about

'find . -print|cpio -oB >>/dev/dat'

?

It wouldn't have the desired effect.

While ">>" means append to the file remember that /dev/dat isn't a "regular" file but is a "device" file. Due to this any writes to it are interpreted by the appropriate driver. Going back to what I wrote earlier the effect would be to either overwrite the tape if it is the "rewind" device or to go to start wrting at the next tape mark if it is the "no rewind" device. That is to say it has exactly the same effect as just doing
>".
 
Old 01-03-2007, 02:23 AM   #5
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE 42.1_64+Tumbleweed-KDE, Mint 17.3
Posts: 4,065

Rep: Reputation: Disabled
A pity . But my thanks for the information .
 
Old 01-03-2007, 02:50 PM   #6
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,075
Blog Entries: 14

Rep: Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251
No problem. I've always liked cpio. Long ago I asked a vendor technical person why one would use tar over cpio or cpio over tar. He said "religion" which I thought was a perfect answer.

Of course since then it appears tar has won the religious war to the point where I now use tar more often that cpio myself despite favoring cpio. I guess that makes me an apostate.
 
Old 01-03-2007, 06:17 PM   #7
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 59
Some googling came up with the command:mt which may be of interest to you.
It's part of the mt-st package.

Here are some commands I noticed....

mt -f /dev/st0 status

# Get to the end of one file
mt -f /dev/st0 fsf 1

# Get to the end of the second file
mt -f /dev/st0 fsf 2

# Get to the end of data
mt -f /dev/st0 eof

# If I understand correctly, that is where you could put in some more data but I don't have a tape drive to try it with.
 
Old 01-04-2007, 02:22 AM   #8
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE 42.1_64+Tumbleweed-KDE, Mint 17.3
Posts: 4,065

Rep: Reputation: Disabled
In view of falling prices for hard disks I'd like to mention dar then (Disk ARchive) http://dar.linux.free.fr/ maybe that is of interest for those who back up without the benefit of a tape drive ... .

Last edited by JZL240I-U; 01-04-2007 at 02:23 AM.
 
Old 01-04-2007, 09:53 AM   #9
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,075
Blog Entries: 14

Rep: Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251
Quote:
Originally Posted by homey
Some googling came up with the command:mt which may be of interest to you.
It's part of the mt-st package.

Here are some commands I noticed....

mt -f /dev/st0 status

# Get to the end of one file
mt -f /dev/st0 fsf 1

# Get to the end of the second file
mt -f /dev/st0 fsf 2

# Get to the end of data
mt -f /dev/st0 eof

# If I understand correctly, that is where you could put in some more data but I don't have a tape drive to try it with.
You missed my mention of the mt command above?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
append files Paul_R Linux - General 6 11-04-2005 07:15 AM
batch append string to the end of a determined line in text files osio Programming 6 06-30-2005 10:28 AM
How to use cpio to extract a cpio archive? linx win Debian 4 06-17-2005 02:53 PM
Trying to Append files to an already made Tar bluedevlx Linux - Newbie 10 11-04-2004 08:37 AM
problem of cpio -idcmv <file-name> for oracle9 downloading files richard-li Linux - General 2 02-26-2004 10:41 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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

Main Menu
Advertisement
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
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration