Creating and restoring a backup from the live system

If required by your application, backups can also be created and restored from the live system, without a TwinCAT/BSD installer stick. Use the scripts TcBackup and TcRestore for this purpose.

Do not create a backup from the running system if the system is writing to the disk at the time of the backup. A backup can become corrupted if the system has write access to the disk during the backup. In other words, make sure that there are no processes running that persistently back up data and that the disk you want to restore your backup to has enough space.

Running TcBackup and TcRestore and writing to and from the file where the backup is saved must be done with root rights. In other words, execute a shell with root rights beforehand, in which you then work, or execute the single command as a string with a shell with root rights. The latter option is illustrated in the following examples.

Proceed as follows:

1. Enter the command doas sh -c "TcBackup.sh --disk /dev/ada0 > backup.tcbkp00" to create a backup from the ada0 disk to the Backup.tcbkp00 file.
2. Enter the command doas sh -c "TcRestore.sh --disk /dev/ada1 < backup.tcbkp00" to restore a backup from the Backup.tcbkp00 file on the ada1 disk.
The two commands can be combined, as follows. The command doas sh -c "TcBackup.sh --disk /dev/ada0 | TcRestore.sh --disk /dev/ada1" creates a backup from the ada0 disk and immediately restores it to the ada1 disk.