Operating System - Linux
1829012 Members
2375 Online
109986 Solutions
New Discussion

cpio not preserving permissions on Redhat

 
joseph wholey
Regular Advisor

cpio not preserving permissions on Redhat

Trying to cpio data from one server to the other as follows...

On target server:
1. mount :/source_dir /mnt
2. cd /mnt
3. find . -print | cpio -pdlvmu /destination

Everything does get copied... but I get the below error as well as the "/destination" directory permissions change from 755 to 700 on the target directory.

cpio: cannot link : Invalid cross-device link. I only see this on Redhat, not Solaris or AIX. Any help would be greatly appreciated.





3 REPLIES 3
Steven E. Protter
Exalted Contributor

Re: cpio not preserving permissions on Redhat

Shalom,

Default permissions on the NFS server may be overriding the settings.

Try tranferring the file and uncompressing it on the other system. If permissions are still screwed, then update red hat to the latest patch level.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
joseph wholey
Regular Advisor

Re: cpio not preserving permissions on Redhat

Shalom to you... not sure what that's going to prove? Where on the NFS server can I change these settings? Even if the cpio to a tar file and then un-tar to the destination works, what does that prove? thx.
Matti_Kurkela
Honored Contributor

Re: cpio not preserving permissions on Redhat

Are you running these commands as an ordinary user, or as root?

What kind of filesystem is the /destination?
What does "grep /destination /proc/mounts" say?

Background:
Linux supports many non-unixlike filesystems. Some of the supported filesystems simply cannot store unix-style file permissions, so the unix-style permission information is auto-generated when needed using a simple algorithm. In these cases, the mount options of the filesystem will dictate the permissions of each file and directory on that filesystem. This is most often encountered with FAT or VFAT filesystems.


"Invalid cross-device link" means that cpio is trying to create a hard link, but on the destination the link "source" and "target" are on different filesystems: one is on the NFS volume and the other is local. In this situation, creating a hard link is impossible in any Unix-like system.

You're using option "l" with the cpio command: it means "link files instead of copying them, when possible". If you omit this option, the "invalid cross-device link" messages should go away.

RedHat uses GNU cpio, which may be slightly different from the version of cpio used on Solaris or AIX. If you're more familiar with those other architectures, I recommend you check the documentation of the GNU cpio before using it:
http://www.gnu.org/software/cpio/manual

MK
MK