System backup and system live guide

OviOS Linux Live is a method to use OviOS only running from a live CD without having to install.

OviOS Linux boots the live image writable in memory, allowing the system to be configured as if it was installed. The challenge here is to save the configuration in case of an intentional or unintentional reboot.

Saving and restoring the configuration in OviOS Linux live is very simple and straightforward.


1. Define an OS Backup Pool.

This is a storage pool that will contain a small volume called "osbackup". The system will store here system backups.

For example, if the pool is called "OVIOSPOOL"

ovios-shell> options system.backup.pool OVIOSPOOL

Changing option: system.backup.pool ==> OVIOSPOOL

ovios-shell>

Note: If you want to reset this option, use reset, or like other options type ""

 This means a pool named "reset" wouldn't work.

ovios-shell> options system.backup.pool reset

OR

ovios-shell> options system.backup.pool ""

Changing option: system.backup.pool ==>

ovios-shell>


2. Define files and / or directories to be backed up.

By default, sync-config (the tool used for backups) backs up the following system configuration files and directories:

/etc/passwd 

/etc/group 

/etc/shadow 

/etc/samba/

/etc/krb5.conf 

/etc/hosts

/etc/resolv.conf

/etc/nsswitch.conf  

/etc/security/ 

/etc/pam.d/system-auth

/etc/tgt/ 

/var/lib/samba/ 

/etc/sysconfig/ovios.conf


Usually, when using OviOS Live, at least the network files should be added to this list.

Add files with options files.to.sync:

ovios-shell> options files.to.sync /etc/ovios/ /etc/ypserv.conf /etc/yp.conf

Changing option: files.to.sync ==> /etc/ovios/ /etc/ypserv.conf /etc/yp.conf

ovios-shell> 

In this example we added the ov-net directory which contains the network configuration files, and the yp.conf and ypserv.conf files. 

You must use this format as in the example above, leave spaces to separate different files and folders.

3. Create a backup.

Run the sync-config tool with option bo or backup-only. If it's the first time you run it, the osbackup dataset will be created and the backup will be written there.

ovios-shell> sync-config bo

osbackup dataset doesn't exist on OVIOSPOOL. Creating now..

Created osbackup dataset

Creating /ovios/OVIOSPOOL/osbackup/osbackup-2020-10-19_13-14-31.tar.gz ...

Created backup osbackup-2020-10-19_13-14-31.tar.gz

ovios-shell>

If the osbackup dataset already exists, the sync-config tool will create a new backup on it.

ovios-shell> sync-config bo

Found backup location to be /ovios/OVIOSPOOL/osbackup

Creating /ovios/OVIOSPOOL/osbackup/osbackup-2020-10-19_13-14-55.tar.gz ...

Created backup osbackup-2020-10-19_13-14-55.tar.gz

ovios-shell>


4. Restore after a reboot.

After a reboot (or in any situation when the Admin needs to restore the config from a backup), make sure the OS system backup pool is imported.

You need to disable the skip.import option, enable forced import if this is a live system, and run zfs-admin start.

ovios-shell> options skip.import off

Changing option: skip.import ==> off

ovios-shell> options force.import on

Changing option: force.import ==> on

ovios-shell>

ovios-shell> zfs-admin start

     Starting importing pools

     SPL Module already loaded

     ZFS Module already loaded

  *  Starting the ZFS Event Daemon...                 [  OK  ]

  *  Importing OVIOSPOOL...                           [  OK  ]

  *  Starting mount on all datasets...                [  OK  ]

  *  Starting share on all datasets...                [  OK  ]

ovios-shell>


Drop to the bash shell, if at this point you are in the ovios-shell,  change directory to your root filesystem (/) and extract the latest backup.

ovios-shell> linuxcmd

Dropping to the Linux bash shell...

ovios-indt:~ # cd /

ovios-indt:/ # tar xvf /ovios/OVIOSPOOL/osbackup/osbackup-2020-10-19_13-14-

osbackup-2020-10-19_13-14-31.tar.gz  osbackup-2020-10-19_13-14-55.tar.gz

ovios-indt:/ # tar xvf /ovios/OVIOSPOOL/osbackup/osbackup-2020-10-19_13-14-55.tar.gz

etc/passwd

etc/group

etc/shadow

etc/samba/

etc/samba/smb.conf

etc/samba/smb.conf.default

etc/krb5.conf

etc/hosts

etc/resolv.conf

etc/nsswitch.conf

etc/security/

etc/security/namespace.conf

etc/security/limits.d/

etc/security/namespace.d/

etc/security/access.conf

etc/security/time.conf

etc/security/limits.conf

etc/security/pam_env.conf

etc/security/namespace.init

etc/security/group.conf

etc/pam.d/system-auth

etc/tgt/

etc/tgt/examples/

etc/tgt/examples/targets.conf.vtl.MSL2024

etc/tgt/examples/targets.conf.example

etc/tgt/examples/targets.conf.vtl.L700

etc/tgt/conf.d/

etc/tgt/targets.conf

var/lib/samba/

var/lib/samba/share_info.tdb

var/lib/samba/bind-dns/

var/lib/samba/group_mapping.tdb

var/lib/samba/winbindd_cache.tdb

var/lib/samba/account_policy.tdb

var/lib/samba/registry.tdb

var/lib/samba/private/

var/lib/samba/private/secrets.tdb

var/lib/samba/private/passdb.tdb

var/lib/samba/private/netlogon_creds_cli.tdb

var/lib/samba/private/msg.sock/

var/lib/samba/usershares/

var/lib/samba/winbindd_privileged/

var/lib/samba/winbindd_idmap.tdb

etc/sysconfig/ovios.conf


After this step, you should run:

ovios-indt:/ # exit

exit

ovios-shell>


To go back to the ovios-shell.

Then, to start up the interfaces and re-assign the IPs:

ovios-shell> services restart network

  *  Stopping dhcpcd on the eth0 interface...                                                                                                                       [  OK  ]

     Bringing up the eth0 interface...

     Starting dhcpcd on the eth0 interface...DUID 00:01:00:01:1f:3e:93:d8:10:c3:7b:45:c0:fc

eth0: IAID 29:e4:50:77

eth0: rebinding lease of 192.168.43.139

eth0: leased 192.168.43.139 for 1800 seconds

eth0: changing route to 192.168.43.0/24

eth0: changing default route via 192.168.43.2

forked to background, child pid 6605

  *                                                                                                                                                                 [  OK  ]

ovios-shell>

And:

ovios-shell> services start


To start all services which were previously enabled with the "options" command.