0

I used this command to copy all directory to another disk:

cp -r -v path_folder_source path_folder_destination

The transfer ran alright - I mean I don't know if resulted any error, because I logged of the session tmux before the see all result of this command - but when I went compare a both folder a I saw different results:

  • folder_source: 120,3 GB with 122534 items
  • folder_destination: 118,7 GB with 122511 items

My questions is:

  • I did this with command correctly?
  • Why has difference between folder, supposedly equal?
1
  • That is the correct command, however without knowing if there are any errors it's hard to say exactly why this happened. You could try running it again and see if it works however I'd use a cp -rvn /path/to/src /path/to/dest the n that I added will prevent cp from overwriting files that already exist.
    – snorp
    Jan 3, 2016 at 2:39

1 Answer 1

-2

In short - you just should run the sync command by the unprivileged user:

$ sudo sync

as root:

# sync

for longer answer visit the other stack.

3
  • 1
    I'm pretty sure that sync is not going to fix this for two reasons: syncing automatically happens every few seconds, and there's no way that 23 files are going to be completely missing due to a sync not happening yet, since closing a file after writing it syncs.
    – Olathe
    Jan 3, 2016 at 2:27
  • Okay so let us be more specific if the OP wants to have the right answer - what are the filesystems over the two "disks"? what files are you trying to copy (arent they too big etc)? The sync is not running automatically, the blocks may be stored in the system cache to speed up the fs processes, sync is need to apply the changes which were not written yet but are in cache. The situation what you described may happed when you unmounted the storage device was not fully synced. Probably some other files are not equal too, run some checksum tests to be sure.
    – roomcayz
    Jan 3, 2016 at 2:39
  • Hello, I try copy one folder with various stuff (e.g. docs, videos, images, files .html, .javascript, and among others. I saw previous results through button right on folder. But this time I used this command "du -h folder" and the result were somewhat different. The source folder has 113GB and the destination folder has 112GB. Exist any command to see difference between folders and their sub-folders? So It would be possible to see what files is was missing. Jan 3, 2016 at 21:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .