Importing and exporting configuration data

7.1 LPAR mode z/VM guest KVM guest

Import configuration data from, or export data to, a text file by using the --import and --export options of the chzdev command. You can also use an existing configuration as a template for a new configuration, for example, for a new Linux® instance.

About this task

The export function can be used, for example, to transfer a device configuration to another system, or to store it for later use as a backup or for a rollback.

1  chzdev %Device or device type selection
1  --export
2.1 <filename>
2.1 -
1  --import
2.1 <filename>
2.1 -
2?  --base
3.1 <path>
3.1 <key=value>
1 --active
1 --persistent
1  --site <site_id>
1  --auto-conf

where:

--export <filename>|-
writes configuration data to a text file called <filename>. If a single hyphen (-) is specified instead of a file name, data is written to the standard output stream. The output format of this option can be used with the --import option. To reduce the scope of exported configuration data, you can select specific devices, a device type, or define whether to export only data for the active or persistent configuration.
--import <filename>|-
reads configuration data from <filename> and applies it. If a single hyphen (-) is specified instead of a file name, data is read from the standard input stream. The input format must be the same as the format produced by the --export option.

By default, all configuration data that is read is also applied. To reduce the scope of imported configuration data, you can select specific devices, a device type, or define whether to import only data for the active or persistent configuration.

You can use this option to import auto-configuration data, see Displaying auto-configuration data.

--base <path> | <key=value>
changes file system paths that are used to access files. If <path> is specified without an equal sign (=), it is used as base path for accessing files in the active and persistent configuration. If the specified parameter is in <key=value> format, only those paths that begin with <key> are modified. For these paths, the initial <key> portion is replaced with <value>.

Example: lszdev --persistent --base /etc=/mnt/etc

-a or --active
applies changes to the active configuration only. The persistent configuration is not changed unless you also specify --persistent.
Note: Changes to the active configuration are effective immediately. They are lost on reboot, when a device driver is unloaded, or when a device becomes unavailable.
-p or --persistent
applies changes to the persistent configuration only. The persistent configuration takes effect when the system boots, when a device driver is loaded, or when a device becomes available.
-s<site_id> or --site <site_id>
applies changes to the persistent configuration for the scope of a particular site that is identified by <site_id>. The site identifier <site_id> is an integer in the range 0 to 9. For more information about site-specific configurations, see Site-specific Linux instantiation.
--auto-conf
applies changes to the auto-configuration. Changes to the auto-configuration take effect when a device becomes available, but do not persist across reboots. This option is primarily intended for use by the boot process. For details about auto-configuration data, see Device configuration for machines running in PR/SM mode.

Examples

  • Textual configuration data is either written to a file or, when you specify the special file name "-", to standard output:
    # chzdev --by-interface enccw0.0.a000 --persistent --export -
    Exporting configuration data to standard output
    # Generated by chzdev on linux.example.com
    [persistent qeth 0.0.a000:0.0.a001:0.0.a002]
    layer2=0
    online=1
  • To export this configuration data to a file called config.txt, issue:
    # chzdev --by-interface enccw0.0.a000 --persistent --export config.txt
  • To apply data in this format to a system’s configuration, use the --import option:
    # chzdev --import config.txt
    Importing configuration data from config.txt
    QETH device 0.0.a000:0.0.a001:0.0.a002 configured
  • To create a persistent configuration for an ECKD™ DASD 0.0.1000 and write it to a new Linux system that is mounted under /mnt/etc, issue:
    # chzdev dasd-eckd 1000 -e -p --base /etc=/mnt/etc
  • To display a configuration that was written to /mnt/etc, issue:
    # lszdev --persistent --base /etc=/mnt/etc
  • To copy the persistent configuration to /mnt/etc, issue:
    # chzdev --all --persistent --export - | chzdev --import - --base /etc=/mnt/etc
    Exporting configuration data to standard output
    Importing configuration data from Standard input
    ECKD DASD 0.0.1234 configured
    FCP device 0.0.190d configured
    FCP device 0.0.194d configured
    CTC device 0.0.c000:0.0.c001 configured
  • To export the site 3-specific configuration data of an ECKD DASD 0.0.f008 to a file config_s3.txt, issue:
    # chzdev dasd-eckd 0.0.f008 --site 3 --export config_s3.txt