Modifying Safepoint to use smaller USB backup

This post describes how to use a disk for Safepoint that is smaller than the size of your My Cloud.

You might want to to this if you already use your MyCloud as a Time Machine Backup, and you don’t need to backup this “share” (since Time Machine is already a back up).

Right now, Safepoint will fail if your USB disk is smaller than your My Cloud (specifically, if the total space used on your My Cloud is larger than your Safepoint USB disk).

But you can modify the Safepoint process to eliminate the “space available” check that Safepoint undertakes.

If you do, then THERE WILL BE NO “SPACE AVAILABLE” CHECK and you will have to manually ensure that the MyCloud shares you are backing up will fit in your USB drive.

For example, I have a 2TB MyCloud, of which 1.5TB is given over to Time Machine, and only 500GB are used as a server for other purposes (music files, etc.). I only need to back up this 500GB.

As described in this posting: https://community.wd.com/t/backup-certain-shares-to-usb/94124/4 (and others) you can exclude files/shares to be backed-up using Safepoint. I’ve excluded Time Machine. So the max that can be backed-up using safepoint is 500GB. And I only want to attach a 500GB disk drive to MyCloud for Safepoint

The next step then is to modify the Safepoint process to eliminate the check for available space. Without modification, Safepoint will fail because the total space used on the MyCloud, including Time Machine, will be greater than 500GB.

Here’s how you eliminate the “space available” check.

If you’ve already excluded shares from Safepoint using the info in other postings, then you know how to SSH to your MyCloud and use vi to edit a file.

Once you have logged on as a root user, you need to navigate to the directory that contains the Safepoint control processes. Do this by entering:

cd /usr/local/NSPT/WDSafe/lib

You can check you’re in the right place if you enter:

ls

You will see the files in this directory, including one called SafeptRunHandler.pm

then enter:

cp SafeptRunHandler.pm SafeptRunHandler.pm.bak

This will make a backup copy of this file in case you need it.
Now you can edit SafeptRunHandler.pm knowing you can always restore it with the backup you created. To edit, you can use the vi editor function (though other methods exist, too). To enter a vi editing session enter:

vi SafeptRunHandler.pm

This will return the contents of this file.

Now to see the line numbers type

:set number

The file will be shown with line numbers.

Navigate (using scrolling and/or arrow keys) to line 913 and remove this and 9 other lines (10 lines in total).

To remove a line, place your cursor in the line to be eliminated and type

dd

For each dd you type, a line of code will be removed.

Here are the lines you want to remove (lines 913 to 922), they say:

if( ( $total_size > $old_size ) && 
             ( $available < ( $total_size - $old_size ) ) )
        {
            $status{code} = $WDST_NOSPACE;
            $status{desc} = "$sp->{handle}: ".
                            "Safe-Point of size \'$total_size\' will not fit ".
                            "into available space \'$available\' on target";
            $logger->Error( $status{desc} );
            goto cleanup;
        }

Once you have removed these lines, type

:wq

That will exit the vi session and save the modified file.

Then type

exit

to leave your SSH session.

Your Safepoint will work, even though the system will look like it’s trying to back up your entire drive (and the Safepoint progress bar will report a large file being backed-up). But only the shares you’ve not excluded will form part of the Safepoint backup. BE WARNED, THOUGH, there will be no test to see if your USB has the space available. You’ll have to make sure you have enough space on the USB for the shares you are backing up.

And if this does’t work for you, you can always restore the original SafeptRunHandler.pm and go back to how it was.

1 Like

Hello,

Thank you for sharing this information.