Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 11 Current »

Cloning is available with SmartServer 2.7 Update 1 and higher.

Cloning can be used to replicate a reference (source) SmartServer IoT to another SmartServer IoT(s), where each cloned (target) SmartServer's configuration will be identical to the reference SmartServer. Cloned SmartServers will have the same CMS configuration, external devices, external data points, custom applications, and custom web pages as the source SmartServer IoT.

Warnings

Using the Storage widget → RESTORE button → CLONE tab preserves the new SmartServer's Serial Number, Host Name, and Install Code, but changes the apollo password to the old SmartServer's password, as well as the Segment ID (SID) and MAC Addresses. In most cases, when you restore a database backup onto a new SmartServer, you will use the CLONE tab. You cannot clone a target SmartServer with the same backup file more than once; however, if you re-image the SmartServer, then you can perform another clone. In addition, you cannot put two SmartServer clones on the same network. 

Using the Storage widget → RESTORE button → SYSTEM tab or DATABASE tab overwrites the new SmartServer's Serial Number, Host Name, MAC Addresses, Install Code, SID, and apollo password.

The reference SmartServer can include the most comprehensive configuration of devices likely to be seen in the field. For subsets of the reference configuration, devices that are not present in some sites can either be ignored or deleted accordingly. Cloned Modbus and BACnet networks should be configured with the same addressing and baud rate information as the reference SmartServer IoT networks. LON networks will need their devices replacing in the CMS with the new UIDs.

To clone a source SmartServer once its configuration is finalized and tested, a system backup image must first be created using the CMS Storage widget. Then, the source SmartServer IoT system backup must be restored onto a target SmartServer using the clone feature.

This section consists of the following:

Prerequisites

Backing up the SmartServer IoT

SmartServer IoT backups are stored on the SD Card in the /media/sdcard/backups directory (there can be multiple backup files on the SD Card).

Backup file names will appear similar to the following example: 

SmartServer-System-Backup-2020-03-10-114532.tgz

The SmartServer IoT's SD Card is formatted using the Linux ext4 filesystem and cannot be read directly by a Windows PC. You can use an SFTP application on a Windows PC, such as WinSCP to read and write backup files from and to the SD Card. WinSCP downloads are available at https://winscp.net/eng/docs/guide_install. However, for speed purposes in a production environment, it is recommended that a Linux PC is used to read or write to the SD Card. If you do not want to modify your existing PC configuration, you can use a trial version of Ubuntu to do this, where you simply boot the PC from a USB drive with a bootable version of Ubuntu installed. Ubuntu downloads are available at https://ubuntu.com/download/desktop.

To create a bootable USB drive from an Ubuntu ISO image, you need to use an application such as Rufus. Rufus downloads are available at https://rufus.ie/.

Alternatively, you can install a dual-boot Ubuntu/Windows or an Ubuntu-only configuration.

Storing User Applications and Data

User applications and data should be located in the directory indicated in the APOLLO_DATA environment variable (typically /var/apollo/data). Doing so ensures that user applications and data are not affected by updates and are included in the SmartServer IoT's backup mechanism.

Connecting to the Console

To receive status updates during SmartServer IoT backup and restore operations, you need to be connected to the SmartServer IoT's  serial console port (USB micro B, 115200, 8,1,N) using a terminal emulator, such as PuTTY for Windows or microterm for Ubuntu.

PuTTY downloads are available at https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html

Microterm
downloads are available at https://sourceforge.net/projects/microterm/.

Cloning the SmartServer IoT

The sections that follow describe the necessary steps to clone a SmartServer IoT, including:

  • Creating a Source SmartServer Backup
  • Copying the Source SmartServer Backup File to the Target SmartServer
  • Restoring the Source SmartServer Backup File to the Target SmartServer

Creating a Source SmartServer Backup

To create a source SmartServer backup, perform the following steps:

  1. Connect an Ethernet patch lead from the source SmartServer IoT's  RJ45 LAN connector to an Ethernet switch port on your local LAN with a DHCP server running (unless you are using a static IP address).

  2. Connect your PC to the same LAN and subnet as the source SmartServer IoT using an Ethernet lead. Alternatively, use the SmartServer's Rapid Fallback feature (if enabled) to set the SmartServer IoT's address to 192.168.1.222, which will allow a direct Ethernet connection from the PC to the SmartServer IoT. In this case you will have to manually configure the PC to be on the same subnet as the source SmartServer IoT.

  3. Remove any USB devices from the source SmartServer. 

  4. Connect the terminal emulator to the console port using a USB cable and power up the SmartServer.

  5. Find the SmartServer IoT's IPV4 address for the eth0 port (shown as inet addr:192.168.168.5 in the example below, third line) by entering the following command at the console: ifconfig

    A result similar to the following appears:

    apollo@smartserver-17q41xs:~$ ifconfig
    eth0      Link encap:Ethernet  HWaddr 00:d0:71:07:46:eb
              inet addr:192.168.168.5  Bcast:192.168.168.255  Mask:255.255.255.0
              inet6 addr: fe80::2d0:71ff:fe07:46eb/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:38427 errors:0 dropped:17168 overruns:0 frame:0
              TX packets:35507 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000
              RX bytes:2909558 (2.9 MB)  TX bytes:6099630 (6.0 MB)
              Interrupt:51 Base address:0x6000
    
    eth1      Link encap:Ethernet  HWaddr 00:d0:71:07:46:ec
              UP BROADCAST MULTICAST  MTU:1500  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000
              RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
              Interrupt:50 Base address:0xe000
    
    ip70      Link encap:Ethernet  HWaddr 00:d0:71:07:6f:50
              inet addr:192.168.239.128  Bcast:192.168.239.255  Mask:255.255.255.0
              inet6 addr: fe80::2d0:71ff:fe07:6f50/64 Scope:Link
              UP BROADCAST RUNNING NOARP MULTICAST  MTU:1500  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:6538 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0
              RX bytes:0 (0.0 B)  TX bytes:380111 (380.1 KB)
    
    lo        Link encap:Local Loopback
              inet addr:127.0.0.1  Mask:255.0.0.0
              inet6 addr: ::1/128 Scope:Host
              UP LOOPBACK RUNNING MULTICAST  MTU:65536  Metric:1
              RX packets:1230995 errors:0 dropped:0 overruns:0 frame:0
              TX packets:1230995 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:0
              RX bytes:170737328 (170.7 MB)  TX bytes:170737328 (170.7 MB)
    
    apollo@smartserver-17q41xs:~$
  6. Connect to the source /wiki/spaces/TEMP/pages/44041710 at:
    1. With SmartServer release 2.8 or higher: https://<IPV4 address>/cms
    2. With SmartServer release prior to 2.8: https://<IPV4 address>:8443/cms

      The CMS login window appears.



  7. Login using the username and password. Note that the username is always apollo, but the password may have been changed from the one that is printed on the rear label of the SmartServer.

  8. Open the Storage widget.

    Note 1: If the Storage widget does not appear on the CMS, you will need to /wiki/spaces/TEMP/pages/44631776.

    Note 2: To best view all of the information on this widget, click the Expand button (  ). 



  9. Click BACKUP



  10. Click BACKUP SYSTEM in the Confirmation dialog box.


  11. Click OK in the Confirmation dialog box to start the backup process. 

A notification (shown below) indicating that the backup started will appear at the top right corner of the CMS. No additional notifications regarding the backup process will be displayed on the CMS.



Messages similar to the following will appear on the console:

Broadcast message from rebootmanager daemon (Tue 2020-03-10 11:19:58 BST)
System going down to perform backup...
going down for reboot NOW

====================================================================
============  Adesto Apollo 2 Backup/Restore Utility  ==============
====================================================================
Version 1.2

 * Initializing... OK
SDCard: /dev/mmcblk2p1

 * Checking required files...
Required files are present.

 * Mounting partitions... OK

Filesystem           1K-blocks      Used Available Use% Mounted on
none                    868600         0    868600   0% /dev
/dev/mmcblk2p1        30634944   1032904  28022828   4% /mnt/mmc_restore
/dev/mmcblk3p3         3232312   2145144    903260  70% /mnt/mmc_main
/dev/mmcblk3p1           16128      8707      7422  54% /mnt/mmc_main/boot
/dev/mmcblk3p5          884676     45860    776660   6% /mnt/mmc_main/var/apollo

getpgdata: found PGDATA=/media/sdcard/postgres
pgdata after stripping leading slash: media/sdcard/postgres
pgdata before returning from getpgdata: 'media/sdcard/postgres'
PGDATA is on SDCard, remount as media/sdcard

 * Backup System...
tar -czf /mnt/mmc_main/media/sdcard/backups/SmartServer-System-Backup-2020-03-10-114532.tgz --exclude-from=etc/backup/excludes --exclude-backups --exclude-caches-all boot home srv var bin data etc lib opt root sbin usr media/sdcard/postgres
 * Backup System, including PGDATA=media/sdcard/postgres...
 * Syncing... OK

 * Unmounting partitions... OK

Procedure Complete.

Rebooting in 5 seconds...


Continue with the SmartServer cloning process following the steps in the section below: Copying the Source SmartServer Backup File to the Target SmartServer.

Copying the Source SmartServer Backup File to the Target SmartServer

Follow the appropriate procedure to copy the source SmartServer backup file to the target SmartServer for your environment below:

  • Using Windows
  • Using Ubuntu

Using Windows

You can use an SFTP application such as WinSCP to read the backup file from the source SmartServer IoT's SD Card, then store it on the Windows PC, and finally write the backup file to the target SmartServer IoT's SD Card. 

Note: This process assumes that the Windows PC, as well as the source and target SmartServer IoT, are all connected to the same subnet and their addresses are known.

The backup file can be read from /media/sdcard/backups on the source SmartServer IoT, copied to a temporary location on the Windows PC, and written to /media/sdcard/backups on the target SmartServer IoT. 

Depending on the infrastructure, this process will take at least 120s to read and write the backup file.

Once the process is completed, the USB console cable should be removed from the source SmartServer.

Continue with the SmartServer cloning process by following the steps in the section Restoring the Source SmartServer Backup File to the Target SmartServer below.

Using Ubuntu

To copy a source SmartServer backup file to the target SmartServer, perform the following steps:

  1. Copy the SmartServer backup file from the source SmartServer's SD Card to the Linux PC.

    Note: Although it is possible to copy the backup file from the source SmartServer to the target SmartServer using an intermediate flash drive, in a production environment, it is more efficient to copy the backup file from the source SmartServer's SD Card to the Linux PC first, and then copy the backup file to the target SmartServer’s SD Card. 

  2. Copy the file from the Linux PC to the target SmartServer SD Card.

  3. Once reboot has completed after the backup operations, power-down the source SmartServer.

  4. Remove the SD Card from the source SmartServer.

  5. Using a suitable USB micro SD Card adapter, insert the SD Card into the adapter (unless the PC has a built in SD Card reader).

  6. Insert the USB adapter into the Linux PC.

  7. Copy the backup file from the SD Card's backups directory to the Linux PC.

  8. Determine the SD Card device by entering the following command at the console: sudo fdisk -l

    Messages similar to the following will appear on the console:

    ubuntu@ubuntu:~$ sudo fdisk -l
    
    Disk /dev/loop0: 1.9 GiB, 2029981696 bytes, 3964808 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    
    Disk /dev/loop1: 89.1 MiB, 93417472 bytes, 182456 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    
    Disk /dev/loop2: 54.7 MiB, 57294848 bytes, 111904 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    
    Disk /dev/loop3: 44.9 MiB, 47063040 bytes, 91920 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    
    Disk /dev/loop4: 160.2 MiB, 167931904 bytes, 327992 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    
    Disk /dev/loop5: 4.2 MiB, 4403200 bytes, 8600 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    
    Disk /dev/loop6: 14.8 MiB, 15462400 bytes, 30200 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    
    Disk /dev/loop7: 956 KiB, 978944 bytes, 1912 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    
    Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 4096 bytes
    I/O size (minimum/optimal): 4096 bytes / 4096 bytes
    Disklabel type: dos
    Disk identifier: 0x96d7c2b4
    
    Device     Boot   Start        End    Sectors  Size Id Type
    /dev/sda1  *       2048    1187839    1185792  579M  7 HPFS/NTFS/exFAT
    /dev/sda2       1187840 1953521663 1952333824  931G  7 HPFS/NTFS/exFAT
    
    Disk /dev/sdb: 28.7 GiB, 30752636928 bytes, 60063744 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disklabel type: dos
    Disk identifier: 0x0033a204
    
    Device     Boot Start      End  Sectors  Size Id Type
    /dev/sdb1  *     2048 60063743 60061696 28.7G  c W95 FAT32 (LBA)
    
    Disk /dev/loop8: 3.7 MiB, 3825664 bytes, 7472 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    
    Disk /dev/sdc: 29.8 GiB, 32010928128 bytes, 62521344 sectors
    Units: sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disklabel type: dos
    Disk identifier: 0x00000000
    
    Device     Boot Start      End  Sectors  Size Id Type
    /dev/sdc1        8192 62521343 62513152 29.8G  c W95 FAT32 (LBA)
    

    In the example above (last line), the SD Card appears as device /dev/sdc1/.

    If you are unsure which device it is, enter the command sudo fdisk -l both with and without the SD Card adapter plugged-in.

  9. Create a local directory to mount the SD Card by entering the following command:
     sudo mkdir /media/mysdcard

  10. Mount the SD Card to the new directory by entering the following command (use the appropriate device determined in step #8):
     
    sudo mount /dev/sdc1 /media/mysdcard

  11. Determine the backup file name by entering the following command (there may be multiple backup files):
    ls /media/mysdcard/backup

    Messages similar to the following will appear on the console:

    ubuntu@ubuntu:~$ ls /media/mysdcard/backups
    SmartServer-System-Backup-2020-03-03-154632.tgz
    SmartServer-System-Backup-2020-03-10-114532.tgz
    SmartServer-System-Backup-2020-03-12-091112.tgz
    Copy the name of the backupfile by selecting the text, right clicking and selecting copy.
  12. Create a directory to store the backup file on the Linux PC by entering the following command:
     sudo mkdir /home/clone

  13. Copy the required backup file the local directory by entering the following command (use the backup file name appropriate for your environment):
    sudo cp SmartServer-System-Backup-2020-03-12-091112.tgz /home/clone

  14. Unmount the SD Card by entering the following command (use the appropriate device for your environment):
    sudo umount /dev/sdc1

  15. Insert the SD Card into the source SmartServer.

  16. Power-down the target SmartServer.

  17. Remove any USB devices.

  18. Remove the SD Card.

  19. Replace the SD Card into the USB SD Card adapter in the Linux PC.

  20. Mount the SD Card by entering the following command (use the appropriate device for your environment):
    sudo mount /dev/sdc1 /media/mysdcard

  21. Copy the backup file from the Linux PC to the SD Card's backups directory by entering the following command (use the backup file name appropriate for your environment): 
    sudo cp /home/clone/System-Backup-2020-03-12-091112.tgz /media/mysdcard/backups

  22. Unmount the SD Card by entering the following command (use the appropriate device for your environment):
    sudo umount /dev/sdc1

  23. Remove the SD Card from the USB adapter.

  24. Insert the SD Card into the target SmartServer.

  25. Remove the USB console cable from the source SmartServer.

Continue with the SmartServer cloning process following the steps in the section below: Restoring the Source SmartServer Backup File to the Target SmartServer

Restoring the Source SmartServer Backup File to the Target SmartServer

To restore a source SmartServer backup file to the target SmartServer, perform the following steps:

Do not clone a target SmartServer with the same backup file more than once, and do not put two SmartServer clones on the same network.

  1. Connect an Ethernet patch lead from the target SmartServer's RJ45 LAN connector to an Ethernet switch port on your local LAN with a DHCP server running (this assumes a new SmartServer).

  2. Connect your PC to the same subnet as the target SmartServer using an Ethernet lead. Alternatively, use the SmartServer's Rapid Fallback feature to set the SmartServer's address to 192.168.1.222, which will allow a direct Ethernet connection from the PC to the SmartServer.

  3. Remove any USB devices from the target SmartServer.

  4. Connect the terminal emulator to the console port using a USB cable and power-up the SmartServer.

  5. Find the SmartServer's IPV4 address by entering the following command at the console: ifconfig

  6. Connect to the source /wiki/spaces/TEMP/pages/44041710 at:
    1. With SmartServer release 2.8 or higher: https://<IPV4 address>/cms
    2. With SmartServer release prior to 2.8: https://<IPV4 address>:8443/cms

      The CMS login window appears.



  7. Login using the username and password. Note that the username is always apollo, but the password may have been changed from the one that is printed on the rear label of the SmartServer.

  8. Open the Storage widget.

    Note 1: If the Storage widget does not appear on the CMS, you will need to /wiki/spaces/TEMP/pages/44631776.

    Note 2: To best view all of the information on this widget, click the Expand button (  ). 



  9. Click RESTORE



  10. Select the CLONE tab on the Restore dialog box and select the backup file that was copied to the SD Card from the drop-down menu as shown in the example below.

    Warnings

    Cloning preserves the new SmartServer's Serial Number, Host Name, and Install Code, but changes the apollo password to the old SmartServer's password, as well as the SID and MAC Addresses. A target SmartServer should not be cloned with the same backup file more than once. You cannot put two SmartServer clones on the same network. 




  11. Click RESTORE.



  12. Click OK in the Confirmation dialog box to start the restore process. 

    Messages similar to the following will appear on the console:

    Broadcast message from rebootmanager daemon (Tue 2020-03-10 15:15:02 BST)
    System going down to perform restore...
    going down for reboot NOW
    
    ====================================================================
    ============  Adesto Apollo 2 Backup/Restore Utility  ==============
    ====================================================================
    Version 1.2
    
     * Initializing... OK
    
    SDCard: /dev/mmcblk2p1
    
     * Checking required files...
    file 'restore' is present.
    file 'preserve' is present.
    file backups/SmartServer-System-Backup-2020-03-10-114532.tgz is present.
    
    Required files are present.
    
     * Checking files integrity...
    e77de975a4eabefc339dae6f132d8803 - OK
    Files validated.
    
     * Mounting partitions... OK
    
    Filesystem           1K-blocks      Used Available Use% Mounted on
    none                    868600         0    868600   0% /dev
    /dev/mmcblk2p1        30634944   1935896  27119836   7% /mnt/mmc_restore
    /dev/mmcblk3p2         3232312   2164084    884320  71% /mnt/mmc_main
    /dev/mmcblk3p1           16128      8707      7422  54% /mnt/mmc_main/boot
    /dev/mmcblk3p5          884676      7268    815252   1% /mnt/mmc_main/var/apollo
    
     * Preserving Identity...OK
    
     * Unmounting partitions... OK
    
     * Formatting partitions...
    
     * Mounting partitions... OK
    
    Filesystem           1K-blocks      Used Available Use% Mounted on
    none                    868600         0    868600   0% /dev
    /dev/mmcblk2p1        30634944   1935932  27119800   7% /mnt/mmc_restore
    /dev/mmcblk3p2         3232312      5756   3042648   0% /mnt/mmc_main
    /dev/mmcblk3p1           16128         1     16128   0% /mnt/mmc_main/boot
    /dev/mmcblk3p5          884676       904    821616   0% /mnt/mmc_main/var/apollo
    
    Always mount sdcard for restore.
    
     * Restoring System... OK
    
     * Restoring original identity...OK
    
     * Syncing... OK
    
     * Unmounting partitions... OK
    
    Procedure Complete.
    
    Rebooting in 5 seconds...


  13. To ensure full functionality after the reboot process completes, perform the following steps:

    1. Power-cycle the target SmartServer to ensure full functionality.

      Note: The target SmartServer may not be accessible over the current IP infrastructure due to IP address changes, and its password will have changed to that of the source SmartServer.
    2. Verify target SmartServer operations.


  • No labels