NETGEAR is aware of a growing number of phone and online scams. To learn how to stay safe click here.
Forum Discussion
InteXX
Sep 11, 2015Luminary
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
OK, got it. Here's how:
- Browse to the ReadyNAS Admin Page
- Go to System\Settings and enable SSH
- Download and install PuTTY from here: http://www.putty.org/
- Add the PuTTY installation folder to your system path (optional)
- 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
- Run the script
- Note that the md5 command result is captured to the local variable and then output to the local console
- You may process this result using standard PowerShell commands as desired
Note that direct support for SSH in PowerShell is coming soon:
HTH
Thanks,
Jeff Bowman
Fairbanks, Alaska
4 Replies
Replies have been turned off for this discussion
- StephenBGuru - 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.
- InteXXLuminary
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 - InteXXLuminary
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 - InteXXLuminary
OK, got it. Here's how:
- Browse to the ReadyNAS Admin Page
- Go to System\Settings and enable SSH
- Download and install PuTTY from here: http://www.putty.org/
- Add the PuTTY installation folder to your system path (optional)
- 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
- Run the script
- Note that the md5 command result is captured to the local variable and then output to the local console
- You may process this result using standard PowerShell commands as desired
Note that direct support for SSH in PowerShell is coming soon:
HTH
Thanks,
Jeff Bowman
Fairbanks, Alaska
Related Content
NETGEAR Academy

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