Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 23

Thread: Check if all data it was well copy

  1. #11
    Join Date
    Apr 2016
    Beans
    356

    Re: Check if all data it was well copy

    I only need check if all content was copied correctly. I have two disks on a Ubuntu server and I want copy all data from disk 1 to disk 2. I am trying this command:

    Code:
    sudo rsync -Havcn /home/user/disk1/folder/* /home/user/disk2/folder_backup/ >> log.txt
    UPDATE1:
    What output can I expect if there are files that have not been copied between source and destination? Should I run this command (inverse)?:
    Code:
    sudo rsync -Havcn /home/user/disk2/folder_backup/ /home/user/disk1/folder/* >> log.txt
    Thanks
    Last edited by sed_faster; June 28th, 2021 at 03:05 PM.

  2. #12
    Join Date
    Nov 2011
    Location
    /dev/root
    Beans
    Hidden!

    Re: Check if all data it was well copy

    Code:
    sudo rsync -Havcn /home/user/disk1/folder/ /home/user/disk2/folder_backup/ >> log.txt
    The files listed in log.txt do not match (either are not copied or are different).

    Please notice the special meaning of a trailing slash in the specification of the source in rsync

    Code:
                  rsync -avz foo:src/bar/ /data/tmp
    
           A  trailing slash on the source changes this behavior to avoid creating
           an additional directory level at the destination.  You can think  of  a
           trailing / on a source as meaning "copy the contents of this directory"
           as opposed to "copy the directory by  name",  but  in  both  cases  the
           attributes  of the containing directory are transferred to the contain‐
           ing directory on the destination.  In other words, each of the  follow‐
           ing  commands copies the files in the same way, including their setting
           of the attributes of /dest/foo:
    
                  rsync -av /src/foo /dest
                  rsync -av /src/foo/ /dest/foo
    Edit: If you are not synchronizing, only copying, you need not worry about extra files in the target (files not matching corresponding files in the source).
    Last edited by sudodus; June 28th, 2021 at 03:23 PM.

  3. #13
    Join Date
    May 2006
    Location
    Switzerland
    Beans
    2,907
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: Check if all data it was well copy

    Oops. Don't mind me. I am not here.
    Last edited by scorp123; June 28th, 2021 at 05:20 PM. Reason: wrong thread

  4. #14
    Join Date
    Apr 2016
    Beans
    356

    Re: Check if all data it was well copy

    Exist difference between folders. I guess the difference it is caused by the different users and groups I have created. Because the data (that I'm copying) came from an external NAS.
    But right now I have two disks on my server and I want copy all data from disk2 to disk1. Which best program and method I should use?

    Maybe If I change all users and groups relating to my files, standardizing everything, I will copy all data without problems. What do you think?

    Thanks

  5. #15
    Join Date
    Nov 2011
    Location
    /dev/root
    Beans
    Hidden!

    Re: Check if all data it was well copy

    I think rsync is the best program. If you run it with elevated permissions (with sudo), it should work without modifying the permissions. I think it is risky to start modifying the users and groups, not so much for plain data files (pictures, documents etc), but definitely for configuration files.

    So you should be able to run it according to my earlier tips, only remember to remove the option n ('dry run').

  6. #16
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Check if all data it was well copy

    Quote Originally Posted by sed_faster View Post
    Exist difference between folders. I guess the difference it is caused by the different users and groups I have created. Because the data (that I'm copying) came from an external NAS.
    But right now I have two disks on my server and I want copy all data from disk2 to disk1. Which best program and method I should use?

    Maybe If I change all users and groups relating to my files, standardizing everything, I will copy all data without problems. What do you think?

    Thanks
    It depends. Do you need those users and groups or not? If you do not, then change all the file and directories on the source to be owned by your normal userid. This assumes they are just data, not OS files or data or configs.

    OTOH, if the users and groups are still necessary, then the solution, as stated by sudodus a few times, is to elevate the permissions using sudo for the rsync command. That will retain the existing owner and groups based on the values in the source.

  7. #17
    Join Date
    Apr 2016
    Beans
    356

    Re: Check if all data it was well copy

    I will try this command "sudo rsync -HSav --progress f1/ f2/" without parameter -n because I want copy all data, this is firstly synchronize.

  8. #18
    Join Date
    Apr 2016
    Beans
    356

    Re: Check if all data it was well copy

    Quote Originally Posted by TheFu View Post
    It depends. Do you need those users and groups or not? If you do not, then change all the file and directories on the source to be owned by your normal userid. This assumes they are just data, not OS files or data or configs.

    OTOH, if the users and groups are still necessary, then the solution, as stated by sudodus a few times, is to elevate the permissions using sudo for the rsync command. That will retain the existing owner and groups based on the values in the source.
    Yes, it is only data, not OS files. I don't need all this users or groups. The system its is the same (I need study more about the Linux because I need learn how management data on this environment.

    Do you suggest change first users/groups and only after run rsync?

  9. #19
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Check if all data it was well copy

    If only 1 userid is needed, then do this first:
    Code:
    sudo chown -R $USER:$USER /home/user/disk1/folder
    Then you won't need sudo for the rsync, since that command above will change the owner to the current userid first.

    If you are serious about learning Linux, then work through this book, http://linuxcommand.org/tlcl.php 1 chapter a week. Do all the exercises - even the "optional" ones.

    If you want to kick-start, there's a free training website: https://linuxjourney.com/ Then go to that book and do the first 25-ish pages. And if you want to keep going, https://gitlab.com/sofreeus/Linux-Camp is beginning admin resource.

  10. #20
    Join Date
    May 2010
    Beans
    3,242

    Re: Check if all data it was well copy

    Could use a bash loop to shasum each file from source and destination to verify

Page 2 of 3 FirstFirst 123 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •