- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: cpio command
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-17-2007 09:54 PM
тАО12-17-2007 09:54 PM
cpio command
gimmme an example.
thanks in advance. points assured.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-17-2007 10:07 PM
тАО12-17-2007 10:07 PM
Re: cpio command
Copy using cpio
#find /sourcedir -depth -xdev |cpio -pdlmuvax /destination
Thanks,
Aneesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-17-2007 10:24 PM
тАО12-17-2007 10:24 PM
Re: cpio command
duplicate directory trees
I think best way is man cpio.
well example is like
cpio -o (copy out)
cpio -i (copy in)
cpio -p (directory copy)
To copy files to magnetic tape,
# cpio -ov < file-list -O/dev/tape/tape0
N number of usages are there....
Hope this would help.
BR,
Kapil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-18-2007 12:23 AM
тАО12-18-2007 12:23 AM
Re: cpio command
man cpio
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-18-2007 12:42 AM
тАО12-18-2007 12:42 AM
Re: cpio command
Cpio command.
cpio command is useful to backup the file systems. It copy file archives in from or out to tape or disk, or to another location on the local machine. Its syntax is
cpio flags [options]
It has three flags, -i, -o, -p
cpio -i [options] [patterns]
cpio -i copy in files who names match selected patterns.
If no pattern is used all files are copied in.
It is used to write to a tape.
cpio -o
Copy out a list of files whose name are given on standard output.
cpio -p
copy files to another directory on the same system.
Options
-a reset access times of input files.
-A append files to an archive (must use with -o).
-b swap bytes and half-words. Words are 4 bytes.
-B block input or output using 5120 bytes per record.
-c Read or write header information as Ascii character.
-d create directories as needed.
-l link files instead of copying.
-o file direct output to a file.
-r rename files interactively.
-R ID reassign file ownership and group information to the user's login ID.
-V print a dot for each file read or written.
-s swap bytes.
-S swap half bytes.
-v print a list of filenames.
Examples
find . -name "*.old" -print | cpio -ocvB > /dev/rst8 will backup all *.old files to a tape in /dev/rst8
cpio -icdv "save"" < /dev/rst8 will restore all files whose name contain "save"
find . -depth -print | cpio -padm /mydir will move a directory tree.
Thanks,
Aneesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-18-2007 04:06 AM
тАО12-18-2007 04:06 AM
Re: cpio command
I never use cpio unless I want to copy device files or special files. If you are copying normal files or directories tar is best. cpio is very slow compared to tar, I have tested this.
You already got the cpio syntax above, if needed.
Good luck
Shahul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-19-2007 12:26 AM
тАО12-19-2007 12:26 AM
Re: cpio command
You can use pax(1) and create either type of files. -x cpio
(I wonder why cpio is slower? Are you using -B to set the blocksize bigger?)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-19-2007 04:45 AM
тАО12-19-2007 04:45 AM
Re: cpio command
#find . -depth -print |cpio -pmvdu /target
#tar -cvf - .|(cd /target; tar -xvf -)
I found the second one much faster than first one. I have not further analysed this, I was satisfied with tar.
Good luck
Shahul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-19-2007 05:31 AM
тАО12-19-2007 05:31 AM
Re: cpio command
I have 2 gigs of data on /disk1 in directory Abc.
I want to copy it to /disk2.
If I do this, I hurt performance of the computer: cp /disk1/Abc /disk2/.
Instead I want to stream the information between the filesystems /disk1 and /disk2.
I run this:
cd /disk1
find Abc -print | cpio -pdumvc /disk2/.
I want ./Abc on a tape.
cd /disk1
find Abc -print | cpio -odumvc > /dev/rmt/0m
I want to read ./Abc from the tape to /disk2.
cd /disk2
cpio -itumvc < /dev/rmt/0m
Why do I like cpio and hate tar? 1. Mainly I just have a harder time getting the syntax correct with tar. 2. Cpio works with streamed data. Tar has to have the tar file in the command. (well it has for me anyway).
3. Cpio copies symbolic links. Tar does not. 4. cpio doesn't break when to go too many subdirectories down a directory structure. (this one is solved in later tar versions).
Things I don't like about cpio: 1. I have a hard time pulling out just one or two files from a cpio archive. It's easier to dump it all to a temp spot and then pull out the file I'm looking for.
2. I hear there are limits to the amount of data that can go through cpio. But I guess I never hit them. I always try to verify the cpio command was successful.
HOW can I verify that cpio worked?
in the case where you copy /disk1/Abc to /disk2/Abc.
cd /
dircmp -s /disk1/Abc /disk2/Abc | more
in the case where you copy /disk1/Abc to tape:
cd /disk2
cpio -idumvc < /dev/rmt/0m
cd /
dircmp -s /disk1/Abc /disk2/Abc | more
In both cases, it is assumed you have enough room to mess with junk copies of directory Abc. It's always good to have a big junk area.
One more tip. If you see "out of phase" error when reading a cpio archive: try to use the B option. try to use the c option.
Yet another tip: If your cpio command runs long and you are running it from an old ascii terminal. It might be running slow because it is display all the files being copied on the slow, ancient screen. Rerun the command with the v for verbose. You will not see anything on the screen. As a result, the computer will not be wasting its time writing to that slow terminal and instead spend its time moving files.
I hope this helps. Remember to assign points they help others get an idea if the reponse was useful or not. And zero points is a points assignment too.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-19-2007 06:38 AM
тАО12-19-2007 06:38 AM
Re: cpio command
You assigned 1 response out of 55?
Do you know how to use the forums?
Do you really expect an answer when you don't care to read any responses?