Nir wrote:I have noticed similar problems with both "cp -r/R" and "rsync -r". But it happened only when I was trying to copy the home folder.
I have copied an Directory (49GB) using *cp -R +<Original file path> <new place>+* command.
When i run du -c | grep total cammand in both original file and the copied filr below are the values,
Original - 50998896
Copied - 50999684
Why it gives different values ??
Do i need to use any other command to copy it ??
Will it be a issue on taking backups ???
Please help me ......
Dude wrote:Don't know where I screwed up.
The cp command has various options to handle and dereference symbolic links, sparse files, privileges, etc. If you want copy the complete directory and file structure I suggest to use the tar command. The following, for instance, will copy everything under /u01 to /mydir.
# cd /u01
# tar -cf - . | (cd /mydir; tar -xf -; sync)
Edited by: Dude on Dec 3, 2012 9:37 AM
Dude wrote:This is what I got, still doing my investigation:
It works fine here, see below example:
# mkfs.ext4 /dev/sdb3
# mkdir /mnt/sdb3
# mount /dev/sdb3 /mnt/sdb3
# cd /lib64
# tar -cf - . | (cd /mnt/sdb3; tar -xf -; sync)
# du -s /lib64
# du -s /mnt/sdb3
# du -s /mnt/sdb3/lost+found
Do you have any hidden files on /extra/sdb6? Are you using the same filesystem? You can try the diff command to see what is different, e.g.:
# diff /lib64 /mnt/sdb3
Only in /mnt/sdb3: lost+found
You can also use the cp copy command, but you will have to add some options to preserve file ownerships, timestamps, links, etc, e.g.:
# rm -rf /mnt/sdb3/lib64
# cp -pdr /lib64 /mnt/sdb3
# du -s /lib64
# du -s /mnt/sdb3/lib64
Edited by: Dude on Dec 3, 2012 2:12 PM
Dude wrote:I "think" (not-yet-verified) what I might have screwed up was that I rebooted (instead of a powering-off then powering-on) to a different OL installation/partition and the temporary and process dependent files in the now dormant partition, from which I was trying to copy/tar/rsync, were not removed.
Applicatons may create temporary and process dependent files that you do not need to copy. You can avoid problems to access such files by closing the appropriate application prior to your copy attempt. Similarily, you cannot copy socket files and you don't need to copy them because they are recreated at application startup. And last not least, you cannot copy a running database since datafiles will be inconsistent.