SUMMARY: cp and inodes

From: Stuart Kendrick (
Date: Tue Nov 30 1999 - 20:05:34 CST

I want to preserve target inode number when I overwrite a file.

Thanks to Roy <> for pointing out that

cat /opt/local/config/inetsvc > /etc/init.d/inetsvc

does precisely what I want.


Original query attached.


---------- Forwarded message ----------
Date: Tue, 30 Nov 1999 17:35:32 -0800 (PST)
From: Stuart Kendrick <>
Subject: cp and inodes

I'm looking for a version of /usr/bin/cp which will preserve target inode
numbers when it overwrites a file.

I'm in a situation where it would be convenient to do something like:
/usr/bin/cp /opt/local/config/inetsvc /etc/init.d/inetsvc
The catch is: /etc/init.d/inetvsc is hard-linked to
/etc/rc2.d/S72inetsvc, and executing this "cp" command breaks the link.

There are various work-arounds, of course, but I haven't thought of one
which is easily automated. For example, editing /etc/init.d/inetsvc,
deleting its contents, reading in /opt/local/config/inetsvc, saving the

Does anyone know of a "cp" which will preserve target file inode numbers?


Stuart Kendrick

This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:13:33 CDT