Hi, I have been using tar/pkzip/winzip etc all my life. What is cpio? I see the man page and I fail to visualise the situations in which I might end up needing cpio. Can a user please throw some light on it? Rohit ********************************************************* Disclaimer This message (including any attachments) contains confidential information intended for a specific individual and purpose, and is protected by law. If you are not the intended recipient, you should delete this message and are hereby notified that any disclosure, copying, or distribution of this message, or the taking of any action based on it, is strictly prohibited. ********************************************************* Visit us at http://www.mahindrabt.com
On Thu, 2003-05-29 at 11:26, Rohit wrote:
Hi,
I have been using tar/pkzip/winzip etc all my life. What is cpio? I see the man page and I fail to visualise the situations in which I might end up needing cpio.
cpio is more robust than tar, i.e. it is easier to recover from an error in the archive. I tend to use cpio when I want to copy the contents of a directory structure from one place to another and keep all ownership and permissions intact on the files and directories copied. Example: /home is getting full, you have a new partition ready. mounted on /mnt where all the data is being copied to. cd /home ; find . | cpio -pdumvB /mnt When command completes, you have a perfect copy of /home in /mnt.
Can a user please throw some light on it?
man page should give some idea about what cpio is capable of. If that is
not enough, a few searches on google should give more details. cpio is
frequently used for backing systems up to tape, like tar, dump and
backup is.
HTH,
--
Anders Karlsson
On Thursday 29 May 2003 06:54, Anders Karlsson wrote:
On Thu, 2003-05-29 at 11:26, Rohit wrote: cpio is more robust than tar, i.e. it is easier to recover from an error in the archive. I tend to use cpio when I want to copy the contents of a directory structure from one place to another and keep all ownership and permissions intact on the files and directories copied.
Example:
/home is getting full, you have a new partition ready. mounted on /mnt where all the data is being copied to.
cd /home ; find . | cpio -pdumvB /mnt
When command completes, you have a perfect copy of /home in /mnt.
I kept telling myslef for weeks I need to look into this and seen this thread. I have a XP/Suse machine with a partition on the XP drive formatted fat32. The fat32 partition is what I use to backup linux and exchange files with XP. I tried your example above and it still changes the permission on the files. No matter where you go outside of Suse, CD's or other drives it changes the permissions. I was going to look into finding something that would do a backup for me of /home and /etc. Thought I would ask the best approach to take to be sure my data was there when I needed it. John
<snip>
I kept telling myslef for weeks I need to look into this and seen this thread. I have a XP/Suse machine with a partition on the XP drive formatted fat32. The fat32 partition is what I use to backup linux and exchange files with XP. I tried your example above and it still changes the permission on the files. No matter where you go outside of Suse, CD's or other drives it changes the permissions. I was going to look into finding something that would do a backup for me of /home and /etc. Thought I would ask the best approach to take to be sure my data was there when I needed it.
AFAIK FAT32 doesn't understand *NIX style permissions so they will not be kept. If you copy anything across partitions in at least a Windows system, the permissions are lost especially if you are crossing from a NTFS to a FAT32 partitions. The same was true with a NTFS to NTFS copy if it crosses a partition. Someone correct me if this is not correct. I had that part (Win permissions) drilled into me when i took the MCSE exams for the beast known as NT4. -- Marshall "Nothing is impossible, we just do not have all the anwsers to make the impossible, possible."
On Thu, 2003-05-29 at 13:34, John Murphy wrote:
On Thursday 29 May 2003 06:54, Anders Karlsson wrote: [snip]
/home is getting full, you have a new partition ready. mounted on /mnt where all the data is being copied to.
cd /home ; find . | cpio -pdumvB /mnt
When command completes, you have a perfect copy of /home in /mnt.
I kept telling myslef for weeks I need to look into this and seen this thread. I have a XP/Suse machine with a partition on the XP drive formatted fat32. The fat32 partition is what I use to backup linux and exchange files with XP. I tried your example above and it still changes the permission on the files.
I assume you copied the files into somewhere on the fat32 partition? Fat32 file system does not support unix file permissions so your files will lose their permissions if you do that. (If I am wrong here, people will correct me. :)
No matter where you go outside of Suse, CD's or other drives it changes the permissions.
CD's use a different file system again, they do not use file permissions like normal unix file system does.
I was going to look into finding something that would do a backup for me of /home and /etc. Thought I would ask the best approach to take to be sure my data was there when I needed it.
You can then instead of copying the files, create a cpio archive.
cd / ; find ./home | cpio -o > /mnt/c/home.cpio
To create gzipped archive:
cd / ; find ./home | cpio -o | gzip -9 > /mnt/c/home.cpio.gz
To read/verify the archive back:
cd / ; cpio -idumvBt < /mnt/c/home.cpio
To read/verify the gzipped archive back:
cd / ; zcat /mnt/c/home.cpio.gz | cpio -idumvBt
To extract, just remove the 't' flag from cpio's options.
HTH,
--
Anders Karlsson
You can then instead of copying the files, create a cpio archive. <snip>
Or... You can create a large file on the FAT32 partition (well, up to 2GB) and make an ext filesystem in it, then mount it using loopback. The Linux data can be put inside a sane filesystem and keeps all permissions, ownerships, etc. The actual filesystem sits on FAT32 and is therefore slow. But it works; I've done it. Whether this helps solve the OP's problem I don't know, 'cos I've not been following the thread. :o} -- "...our desktop is falling behind stability-wise and feature wise to KDE ...when I went to Mexico in December to the facility where we launched gnome, they had all switched to KDE3." - Miguel de Icaza, March 2003
participants (5)
-
Anders Karlsson
-
Derek Fountain
-
John Murphy
-
Marshall Heartley
-
Rohit