It seems there is a BUG with cp ! I regularly encounter a problem with the order "cp - al " on several of backup under CENTOS. I m using rsnapshot for the backup.
My backup works with Rsnapshot application , which using "cp. -al" command This is reproductible *each time*. Note the bizarre error message above (hardlinking over itself : ./daily.HARD_COPY" --> "./daily.HARD_COPY"... and not "./daily.0" ---> "./daily.HARD_COPY") : .snapshots]# cp -al daily.0 daily.HARD_COPY cp: cannot create hard link `daily.HARD_COPY/localhost/home/sauvegardes/sauvegarde_microlog/copacu/COUREVEN/00001284.doc' to `daily.HARD_COPY/localhost/home/sauvegardes/sauvegarde_microlog/copacu/COUREVEN/00001284.doc': No such file or directory .snapshots]# Yes, that file is missing on the copy. .snapshots]# ls -l daily.HARD_COPY/localhost/home/sauvegardes/sauvegarde_microlog/copacu/COUREVEN/00001284.doc ls: daily.HARD_COPY/localhost/home/sauvegardes/sauvegarde_microlog/copacu/COUREVEN/00001284.doc: No such file or directory .snapshots]# And the file is not corrupted .snapshots]# mv daily.0/localhost/home/sauvegardes/sauvegarde_microlog/copacu/COUREVEN/00001284.doc ./ .snapshots]# cp -al 00001284.doc 00001284.doc-hard-link .snapshots]# ls -l 00001284.doc-hard-link -rwxr--r-- 27 nobody nobody 30720 Jun 28 2006 00001284.doc-hard-link .snapshots]# It is working if we remove the file: .snapshots]# cp -al daily.0 daily.HARD_COPY2 .snapshots]# echo $? 0 .snapshots]# This is reproductible: .snapshots]# cp -al daily.0 daily.HARD_COPY3 cp: cannot create hard link `daily.HARD_COPY3/localhost/home/sauvegardes/sauvegarde_microlog/copacu/COUREVEN/00001284.doc' to `daily.HARD_COPY3/localhost/home/sauvegardes/sauvegarde_microlog/copacu/COUREVEN/00001284.doc': No such file or directory .snapshots]# ls -l daily.HARD_COPY3/localhost/home/sauvegardes/sauvegarde_microlog/copacu/COUREVEN/00001284.doc ls: daily.HARD_COPY3/localhost/home/sauvegardes/sauvegarde_microlog/copacu/COUREVEN/00001284.doc: No such file or directory .snapshots]# ls -l daily.0/localhost/home/sauvegardes/sauvegarde_microlog/copacu/COUREVEN/00001284.doc -rwxr--r-- 27 nobody nobody 30720 Jun 28 2006 daily.0/localhost/home/sauvegardes/sauvegarde_microlog/copacu/COUREVEN/00001284.doc .snapshots]# with coreutils 8.4 it is the same thing with another error message. But the file is coping: .snapshots]# /usr/bin/cp-8.4 --version cp (GNU coreutils) 8.4 .snapshots]# /usr/bin/cp-8.4 -al daily.0 daily.HARD_COPY4 /usr/bin/cp-8.4: cannot create link `daily.HARD_COPY4/localhost/home/sauvegardes/sauvegarde_microlog/copacu/COUREVEN/00001284.doc': File exists .snapshots]# ls -l daily.HARD_COPY4/localhost/home/sauvegardes/sauvegarde_microlog/copacu/COUREVEN/00001284.doc -rwxr--r-- 28 nobody nobody 30720 Jun 28 2006 daily.HARD_COPY4/localhost/home/sauvegardes/sauvegarde_microlog/copacu/COUREVEN/00001284.doc .snapshots]# Someone have the same bug on debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=512831 Please help! .snapshots]# rpm -qa rsnapshot rsnapshot-1.3.0-1.el5.rf .snapshots]# .snapshots]# cp --version cp (GNU coreutils) 5.97 .snapshots]# cat /etc/redhat-release CentOS release 5 (Final) .snapshots]# .snapshots]# rpm -qa coreutils coreutils-5.97-23.el5_4.1 .snapshots]# # uname -a Linux sageetbellierbackup.altiva.org 2.6.18-8.1.14.el5 #1 SMP Thu Sep 27 18:58:54 EDT 2007 i686 i686 i386 GNU/Linux .snapshots]# df -h Filesystem Size Used Avail Use% Mounted on /dev/md0 4.8G 308M 4.2G 7% / tmpfs 247M 0 247M 0% /dev/shm /dev/md5 434G 106G 306G 26% /home /dev/md4 965M 18M 898M 2% /tmp /dev/md2 4.8G 1.5G 3.1G 33% /usr /dev/md3 5.7G 501M 4.9G 10% /var .snapshots]#
