Backup and Restore

How to Create a Backup and Restore a Motorcortex Image

Motorcotex uses USB-drives to restore and backup images of Motorcortex Systems. Please select the stick that you are using:


An industrial PC runs MCX-RTOS from its internal disk. To put the image there, you boot the controller from a USB imager stick that carries the image, and the stick writes it to the disk. It takes four parts; click one to jump to it.

Before you start

  • The Intel image and the imager stick image, both downloaded from the store: see Download.
  • An empty USB drive of at least 8 GB.
  • A keyboard and a display for the controller, or a network cable between your PC and the controller.

Create the imager stick

Insert the USB drive into your PC, then write the imager stick image to it. Select the operating system of your PC:


Ubuntu writes the image with its Disks tool, through Disk Image Writer.

  1. In your file manager, right-click the imager stick image (…mcx-clonezilla….img.xz) and choose Open With › Disk Image Writer.

  2. In the Restore Disk Image window, set Destination to your USB drive. Check the size and name: the wrong choice erases another disk.

  3. Press Start Restoring... and confirm.

    Restore Disk Image window with the imager stick image selected, the Destination list and the Start Restoring button highlighted
  4. When writing is done, Ubuntu mounts the ImageData partition of the stick.

Watch it as a video

Windows has no built-in tool to write a disk image, so you use a separate one such as Rufus.

  1. Install and start the disk image writer.
  2. Select your USB drive and the imager stick image (…mcx-clonezilla….img.xz). Check that you picked the USB drive: the wrong choice erases another disk.
  3. Start writing and wait until it is done.
  4. The stick now shows up as a drive called ImageData.

There is no tested procedure for macOS yet. Use an Ubuntu or Windows PC to create the stick.

Copy the image onto the stick

The stick has a partition called ImageData. The imager looks there for the images it can install.

  1. Open the ImageData partition of the stick in your file manager.
  2. Copy the Intel image (the .img.xz file) into it.
  3. Eject the stick safely before you pull it out.

Boot the controller from the stick

  1. Switch the controller off.

  2. Insert the imager stick into a USB port of the controller.

  3. Switch the controller on. It boots from the stick.

    If it starts from its internal disk instead, enable booting from USB in the controller’s BIOSThe BIOS or UEFI setup is the firmware menu of a PC, where you choose which drive it starts from. You usually open it by pressing a key such as Del or F2 while the PC starts. , or pick the stick in its boot menu.

Watch the boot and install as a video

Open the imager terminal

You give the imager its commands in a terminal. Open it on the controller itself, or from your PC over the network:


Connect a keyboard and a display to the controller. After the stick has booted, the display shows the imager terminal, ready for a command. If it asks you to log in, use the user admin and the password vectioneer.

Imager terminal on the controller's display after booting from the stick

With SSHSSH (Secure Shell) opens a terminal on another computer over the network. Ubuntu, macOS and Windows 10 and later have the ssh command built in. you open the imager terminal from your PC, without a keyboard or display on the controller.

  1. Connect your PC to the controller’s network port with a network cable.

  2. Give your PC’s network adapter an address in the 192.168.2.x range, for example 192.168.2.10: see Configure your network.

  3. Open a terminal on your PC and connect to the controller at controller_ip_addressThe IP address of your controller. In most cases 192.168.2.100.:

    ssh admin@controller_ip_address
    
  4. Log in with the password vectioneer. The terminal shows the imager’s welcome text.

    Terminal after ssh admin@192.168.2.100: Clonezilla with motorcortex imaging scripts, quickstart mci restore or mci backup, more information mci-help

Run mci-help for more information on the imager commands.

Install the image

The imager has two commands: mci restore writes an image from the stick to the controller’s disk, and mci backup saves the controller’s disk to the stick. To keep what is on the controller now, back it up first.


  1. Start the install:

    mci restore
    
  2. Choose the image to install: the Intel image you copied into ImageData.

  3. Choose the disk to install it on: the controller’s internal disk, usually /dev/sda. The disk must be at least as large as the image.

  4. Wait until the imager is done, which takes a while. It ends with Done: and the partitions of the disk.

    End of the mci restore output: the filesystem on /dev/sda2 is resized, the partition table shows an EFI and a platform partition, followed by Done
  5. Check the output for errors.

  6. Pull out the imager stick and restart the controller:

    sudo reboot
    

The controller now starts MCX-RTOS from its disk.


A backup saves the controller’s disk as an image on the stick, so you can install it again later with mci restore. Make sure the stick has enough free space.

  1. Start the backup:

    mci backup
    
  2. Choose the source disk: the controller’s internal disk, usually /dev/sda.

  3. Choose the target directory on the stick. The imager offers a new directory named after the date and time, for example /mnt/usb/2026-01-06_15-44-42_mci-fsa-image.

    Choose Source Device:
    1) sda /dev/sda
    ...
    Choose Target Image Directory:
    1) /mnt/usb/2026-01-06_15-44-42_mci-fsa-image   (new directory)
    ...
    Done
    
  4. Wait until the imager shows Done.

  5. Pull out the imager stick and restart the controller:

    sudo reboot
    

The backup is a directory of filesystem archives, not a raw disk image. mci restore can install it, but a virtual machine such as QEMU cannot start from it.

Make a raw disk image for QEMU

A raw disk image is one file with the whole disk in it, which QEMU can start. You make it by restoring the backup into an empty image file on the stick. The stick needs room for the backup and for the full image file, 6 GB in this example.

  1. Go to the stick and check it is mounted:

    cd /mnt/usb
    ls -lart
    
  2. Create an empty 6 GB image file:

    truncate -s 6G temp.img
    
  3. Attach it as a loop device and see which one it got:

    sudo losetup -fP temp.img
    losetup -a
    
    /dev/loop1: []: (/mnt/usb/temp.img)
    
  4. Back up the controller as above with mci backup, if you have not done so yet.

  5. Restore the backup into the loop device. Use the loop device from step 3:

    mci restore -d /dev/loop1
    
  6. Check that the loop device now has partitions:

    lsblk
    
    NAME     MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
    loop1      7:1    0     6G  0 loop
    ├─loop1p1 259:2    0    34M  0 part
    └─loop1p2 259:3    0     6G  0 part
    
  7. Detach the loop device:

    sudo losetup -d /dev/loop1
    
  8. Check the partition table of the image file:

    fdisk -l temp.img
    
    Disklabel type: gpt
    
    Device     Start      End  Sectors Size Type
    temp.img1   2048    71615    69568  34M EFI System
    temp.img2  71616 12582847 12511232   6G Linux filesystem
    

temp.img is now a raw disk image. You can start it in QEMU: see Run a virtual machine.


The MOTORCORTEX-Imager USB Stick is a bootable USB drive that can be used to create backups and restore images of MOTORCORTEX Systems.

Downloading and flashing the MOTORCORTEX-Imager image to a USB stick

  1. You will need an USB Stick of at least 6Gb and at least 7Gb of free space on your PC.
  2. Download the latest MOTORCORTEX-Imager release: MOTORCORTEX-Imager.
  3. Extract the image, so you should have a 6Gb .img file.
  4. On Windows systems, you will need an external tool to write disk images to an USB device. There are several options, one of them is http://unetbootin.github.io. On most Linux distributions you can just on the img file and this will open the Disk Image Writer tool.
  5. Write the image to your USB Drive.
  6. When done, you can mount the stick on your system and copy an existing image file onto the ImageData partition of the stick.

Booting from the MOTORCORTEX-Imager USB stick

The Motorcortex-Imager can be used with a screen and keyboard attached to the controller or over an SSH connection, so no screen and keyboard is necessarily.

Using a Screen and Keyboard

  1. Make sure the controller is switched off.

  2. Insert the Motorcortex-Imager USB Stick into an available USB port of the controller.

  3. Attach a keyboard to one of the USB-ports and a display to the HDMI-port.

  4. Switch the controller on.

  5. If all is correct you will see the something like the picture below:

    image not found

If above screen does not appear, check the screen and usb connection. If that does not help, check the bios settings of the Motorcortex Controller, it might be that USB stick is not first in the boot order.

Using SSH

  1. Make sure the controller is switched off.

  2. Insert the Motorcortex-Imager USB Stick into an available USB port of the controller.

  3. Switch the controller on.

  4. Give the controller some time to boot. Log in after 20 seconds using a SSH client like Putty, the Linux Terminal or Windows Command Line. Type

    ssh tc@controller_ip_address

Log in with password vectioneer.

  1. If all is correct you will see the something like the picture below:

    image not found

    If above screen does not appear, check network settings and network connection (tip: first try

    ping controller_ip_addressThe IP address of your controller. In most cases 192.168.2.100.

    If that does not help, check the bios settings of the Motorcortex Controller, it might be that USB stick is not first in the boot order.

Making a back-up

  1. Type sudo mcx-backup to start the back-up procedure.

  2. Choose which disk you want to back-up. Hard disks and solid state disks usually start with SD.. SD cards and USB sticks with eMMC.

  3. Next choose where you want to store your image:

    1. This is the default option, it stores it on the USB stick (/mnt/usb/), followed by the date and time on the controller + mcx-image.img.xz.
    2. It is also possible to choose your own name and location. Type /mnt/usb/ to store it on the USB stick. Follow this by the name you want to give. End with .img or .img.xz. The .xz means that the file is zipped. It is recommended to use zip, since otherwise the image file will be the size of the disk (in case of the Motorcortex Fitlet2 this is 32GB). If you follow this you will get something like:

    /mnt/usb/2020-04-08_another-image_name.img.xz

  4. Creating a backup image will take some time. You can watch the progress in the console.

  5. When the backup is finished the number of bytes written will be shown. Please check if there are any errors being reported that may indicate that creating the image has failed.

    image not found
  6. Now you can reboot or poweroff. In case you are done with the back-up and want to go back to the Motorcortex Operating System, type:

    sudo poweroff

  7. Wait for for the system to power off. During this time any cached data is still written to the disk, so no not switch off early.

  8. The system should reboot or power off automatically. At that time remove the USB stick.

  9. Switch on the power again to start the system from the internal storage again.

  10. It is good practice to restore an image to another system or boot the image in a virtual box, to see if the backup went well.

Restoring an image (Cold Start)

This method can be used to install a fresh MOTORCORTEX-OS image or a backup image to your controller.

  1. If the MCX boot stick does not already contain your source image, copy it into the ImageData partition of the USB stick. Supported image file formats are raw image (.img), compressed images (.img.xz) or WIC images (.wic).
  2. Boot from the USB stick and log into the system (see above)
  3. Type sudo mcx-restore -f to start the restore procedure. The -f option will expand the image to use the full disk size, this is useful if you are restoring a truncated image and you wish to use all available disk space on the target system.
  4. Choose which image you would like to restore.
  5. Choose the drive where you want to restore your image to.
  6. Be patient, restoring the image will take some time. When the process is done, check for any errors in the console
  1. You will get the message Done when the process is finished.

    image not found
  2. Now you can reboot or poweroff. In case you are done with the back-up and want to go back to the Motorcortex Operating System, type:

    sudo poweroff

  3. Wait for 20 seconds for the system to power off.

  4. Switch off the power of the controller.

  5. Remove the USB stick.

  6. Switch on the power again.

  7. Done.