Windows to Linux Migration Guide

This guide will help DIY Windows users to migrate their provider to a Linux OS installation while keeping their provider ID and used data. Performing this migration requires a reasonable degree of knowledge of both Windows and the Linux OS you choose along with how the ScPrime software works.
This guide assumes you are migrating from one Windows PC to another PC running Linux. If you are upgrading the same PC from running Windows to Linux, the main steps will be the same but you will need to copy the metadata off of the OS drive before installing Linux and then copy it back. The guide also won’t cover the Linux OS installation itself or which Linux distro to use, that is left for the user based on their personal preference.
The first step is to check the status of your Windows provider using the ‘spc host’ command.
Here we can see our Provider ID, make a note of this to ensure when you first start up the provider on Linux this is the same. The main action to take before starting the migration is to remove all bar the first folder on Windows should you have multiple storage folders as above. This will make changing the paths from Windows paths to Linux paths later on much easier as there’s no chance then to mix them up. This step isn’t mandatory but reduces the chances of errors. In the example above we will remove f:\Data using ‘spc host folder remove f:\Data’, this command can take a long time to complete, spd can sometimes stop responding and the host therefore goes offline while spd doesn’t respond to the scanners, this is expected and should be left to complete. All the data from the folder being removed is moved to the remaining folders. Repeat this until you have just 1 storage folder left like we have below.
While these folder operations are being carried out, the Linux PC can be setup, install the Linux distro of your choice and also install the ScPrime software from the Software page. Unzip the spd and spc files to a folder of your choice, for example '/home/<USER>/ScPrime' where USER is your Linux user.
Once the Windows folder operations have completed and you are down to a single storage folder, you will need to stop spd using ‘spc stop’. Now you can copy the metadata folder from the Windows PC to the Linux PC, that can be via a USB pen drive, FTP, Secure Copy Protocol (SCP!) or whatever method you are comfortable with. On Linux place the metadata in '/home/<USER>/.scprime' which is the default location in Linux when running spd with the user’s account. The default location for the metadata on Windows is 'C:\Users\<USER>\AppData\local\ScPrime' as shown below:
For copying or moving over the storage folder there are 2 options. If you have external USB drives, these can simply be unplugged from the Windows PC, connected to the Linux PC and mounted (ensure that the drives are set to auto mount on system startup), the same can be done for internal drives if you wish. If you follow this process then the storage folder called ‘Data’ in our example above will still be present on the drive.
The alternative approach if you have spare drives is to install a new drive in the Linux PC and then copy the Data folder from the Windows PC to the Linux PC on the new drive. In this case you need to create a folder on the new drive in the Linux PC, this can be a different name from the Windows folder name, we are using a folder called 'hostdata' in this guide.
Whichever method you followed, you should now have your storage folder with 2 files, siahostdata.dat and siahostmetadata.dat on the Linux PC along with the metadata in /home/<USER>/.scprime as below.
For the rest of this guide we’ll assume the drive is mounted at ‘/mnt/disk1’, replace this path with the location you have mounted your drive for the following commands.
We now need to edit a file in the metadata folder to change the Windows folder path to the Linux path. This file will be in '/home/<USER>/.scprime/host/contractmanager/contractmanager.json'. Use a text editor to open this file and change the Path value from 'E:\Data' to '/mnt/disk1/hostdata' (vi or nano are typically pre-installed in most Linux distros). An example is shown below:
The line ‘"Path": "E:\\Data",’ should be changed to ‘"Path": "/mnt/disk1/hostdata",’.
Exit and save the file.
Now you are ready to start up the provider. Assuming the folder locations are as above, change directory to where spd and spc are located, /home/scprime/ScPrime for example if our user is ‘scprime’. Then run the following command to start spd
‘nohup ./spd -M gctwh’
This assumes you are running on default ports and have stored your metadata in the default location. If not, consult the following guide for how to start on non-default ports and the Linux Setup guide for how to specify a non-default metadata location. Then run ‘./spc host’ and check the Provider ID is the same as noted earlier on the Windows Provider and confirm the folder path is as you specified in the contractmanager.json file. Finally you’ll need to unlock your wallet using ‘./spc wallet unlock’ and use your wallet seed or password from the Windows provider.
To ensure over the next few days/weeks of running your provider on Linux, spd is able to read and write to the storage folders and there’s no permissions issues etc., run the following command and check failedreads and failedwrites are 0:
curl -A "ScPrime-Agent" "localhost:4280/host/storage"
An example output looks like:
xaminer-diy5:~# curl -A "ScPrime-Agent" "localhost:4280/host/storage"
Congratulations, you are now running your DIY Provider on Linux. From here, you can now upgrade to the Linux Full License Xa-Miner software using the following guide. Or if you plan to continue running with the Basic license, check the Linux Setup guide to setup things like the auto startup script and to learn how to change settings, add more storage folders etc.