NETGEAR is aware of a growing number of phone and online scams. To learn how to stay safe click here.

Forum Discussion

InteXX's avatar
InteXX
Luminary
Sep 11, 2015
Solved

How to backup from remote to local

I'm preparing a script to perform a nightly backup of files from my Windows server to my RN104. After each copy action is complete I'd like the script to compare the checksums for the file as it exists in both locations, in order to assure accuracy during transfer (the files are quite large).

 

Is there a way for my script to SSH into the NAS and obtain this information?

 

Thanks,
Jeff Bowman
Fairbanks, Alaska

 

  • InteXX's avatar
    InteXX
    Sep 13, 2015

    OK, got it. Here's how:

     

    1. Browse to the ReadyNAS Admin Page
    2. Go to System\Settings and enable SSH
    3. Download and install PuTTY from here: http://www.putty.org/
    4. Add the PuTTY installation folder to your system path (optional)
    5. Create a simple PowerShell script with this code, modifying the file location where necessary: 
      $CheckSum = (plink -pw password root@readynas md5sum /data/ShareName/Folder/File.txt) | Out-String
      $CheckSum
    6. Run the script
    7. Note that the md5 command result is captured to the local variable and then output to the local console
    8. You may process this result using standard PowerShell commands as desired

     

    Note that direct support for SSH in PowerShell is coming soon:

     

    http://blogs.msdn.com/b/powershell/archive/2015/06/03/looking-forward-microsoft-support-for-secure-shell-ssh.aspx

     

    HTH

     

    Thanks,
    Jeff Bowman
    Fairbanks, Alaska

     

     

4 Replies

Replies have been turned off for this discussion
  • StephenB's avatar
    StephenB
    Guru - Experienced User

    You'd need to install something on the NAS to compute the checksum and return it to you. 

     

    You can get the same effect by using Microsoft's FCIV freeware ( https://support.microsoft.com/en-us/kb/841290#bookmark-4).  It has a CLI interface and can checksum a file using a network path (e.g., FCIV  \\nasname\sharename\filename works).  So you can checksum the source and destination from your script on the server, and compare the two.

     

    FCIV would be a bit slower, since it is reading the file over the network to compute the checksum.  But it would be simpler to implement.

    • InteXX's avatar
      InteXX
      Luminary

      For the life of me, I cannot recall what I was thinking when I chose this subject line for my question. It has nothing whatsoever to do with what I'm trying to accomplish. Oh well...

       

      ANYWAY...

       

      The files to verify are hundreds of gigabytes in size; copying them back over to the source to get a checksum is prohibitive (probably error-prone as well). From the looks of it, I should be able to run it on the target (RN104) using md5 in a script local to the ReadyNAS: http://linux.byexamples.com/archives/198/md5-checksum-how-to/

       

      As far as running that script from the target, I found this: http://stackoverflow.com/a/2732991/722393

       

      From there, it shouldn't be that awfully difficult to figure out the stdin/stdout sequence for passing the md5-derived value from the target back to the source.

       

      Following this line of thinking, I just need to know how to enable my RN104 to accept the call from the source.

       

      Thanks,
      Jeff Bowman
      Fairbanks, Alaska

       

    • InteXX's avatar
      InteXX
      Luminary

      For the life of me, I cannot recall what I was thinking when I chose this subject line for my question. It has nothing whatsoever to do with what I'm trying to accomplish. Oh well...

       

      ANYWAY...

       

      The files to verify are hundreds of gigabytes in size; copying them back over to the source to get a checksum is prohibitive (probably error-prone as well). From the looks of it, I should be able to run it on the target (RN104) using md5 in a script local to the ReadyNAS: http://linux.byexamples.com/archives/198/md5-checksum-how-to/

       

      As far as running that script from the target, I found this: http://stackoverflow.com/a/2732991/722393

       

      From there, it shouldn't be that awfully difficult to figure out the stdin/stdout sequence for passing the md5-derived value from the target back to the source.

       

      Following this line of thinking, I just need to know how to enable my RN104 to accept the call from the source (via SSH).

       

      Thanks,
      Jeff Bowman
      Fairbanks, Alaska

       

    • InteXX's avatar
      InteXX
      Luminary

      OK, got it. Here's how:

       

      1. Browse to the ReadyNAS Admin Page
      2. Go to System\Settings and enable SSH
      3. Download and install PuTTY from here: http://www.putty.org/
      4. Add the PuTTY installation folder to your system path (optional)
      5. Create a simple PowerShell script with this code, modifying the file location where necessary: 
        $CheckSum = (plink -pw password root@readynas md5sum /data/ShareName/Folder/File.txt) | Out-String
        $CheckSum
      6. Run the script
      7. Note that the md5 command result is captured to the local variable and then output to the local console
      8. You may process this result using standard PowerShell commands as desired

       

      Note that direct support for SSH in PowerShell is coming soon:

       

      http://blogs.msdn.com/b/powershell/archive/2015/06/03/looking-forward-microsoft-support-for-secure-shell-ssh.aspx

       

      HTH

       

      Thanks,
      Jeff Bowman
      Fairbanks, Alaska

       

       

NETGEAR Academy

Boost your skills with the Netgear Academy - Get trained, certified and stay ahead with the latest Netgear technology! 

Join Us!

ProSupport for Business

Comprehensive support plans for maximum network uptime and business peace of mind.

 

Learn More