backup – Data or system volume group backup management.¶
Synopsis¶
This module manages backup image of data or system volume group on a logical partition (LPAR).
It uses mksysb or savevg commands to create backup image of a volume group either in a file or onto a device.
It uses restvg or alt_disk_mksysb to restore a backup image to disk(s).
mksysb and alt_disk_mksysb operate on system volume group creating and restoring installable backup image while savevg and restvg operate on data volume group.
Requirements¶
The below requirements are needed on the host that executes this module.
AIX >= 7.1 TL3
Python >= 2.7
Privileged user with authorization: aix.system.install
Parameters¶
- action (True, str, None)
Specifies the operation to perform on the LPAR.
create
to create a backup image.
restore
to restore a backup image.
view
to get useful information about a backup image.- type (optional, str, savevg)
Specifies the type of backup object to operate.
mksysb
operates on backup of the operating system (that is, the root volume group) of a LPAR target.
savevg
operates on LPAR savevg, that is all files belonging to a volume group.Discarded for action=view as this action only applies to savevg.
- name (optional, str, None)
Specifies the targets of the operation.
Discarded if type=mksysb.
Required if action=create and type=savevg, then it specifies the volume group to back up.
If action=restore and type=savevg, it specifies the disk device to restore to and do not use the one in the vgname.data file.
- flags (optional, str, None)
Specifies additional flag to pass to the command. Refers to IBM documentation for details.
For action=create and type=mksysb, you could use
-a -A -b number -F filename -G|-N -M -P -t path -T -V -Z
.For action=restore and type=mksysb, you could use
-p platform -L mksysb_level -c console -K -O -g -k -r -z -T -S -C
.For action=create and type=savevg, you could use
-a -A -b Blocks -p -T -V -Z
.For action=restore and type=savevg, you could use
-b Blocks -n -P PPsize
.- location (optional, path, None)
Specifies the location of the backup files. It can be a device or file path.
When type=savevg or action=view, the default device is
/dev/rmt0
.Required if action=view or type=mksysb.
- disk (optional, list, None)
Specifies the name or names of the target disk(s) where the alternate rootvg is created.
This disk or these disks must not currently contain any volume group definition.
Required if action=restore and type=mksysb.
- script (optional, path, None)
Specifies the full path of a customization script file to run at the end of the mksysb installation.
Can be used if action=restore or type=mksysb.
- resolv_conf (optional, path, None)
Specifies the full path of a alternate resolv.conf file to replace the existing one after the mksysb installation.
Can be used if action=restore or type=mksysb.
- phase (optional, str, None)
Specifies the phase(s) to execute during the invocation of the alt_disk_mksysb command.
Can be used if action=restore or type=mksysb.
- data_file (optional, path, None)
Specifies a full path filename to use instead of the one from the image being restored.
If type=mksysb it specifies the image.data file.
If type=savevg it specifies the vgname.data file.
Can be used if action=restore.
- create_data_file (optional, str, no)
Specifies to create the data file containing information on the vloume group, logical volumes, file systems and their sizes.
If volume_group=rootvg, then data file will be in
/image.data
.If
volume_group
is a data volume group, data file will be in/tmp/vgdata/vgname/vgname.data
.Specify create_data_file=mapfile to create the MAPFILE containing the mapping of the logical to physical partitions for each logical volume in the volume group. This mapping can be used to allocate the same logical-to-physical mapping when the image is restored.
Can be used if action=create.
- exclude_fs (optional, path, None)
Specifies a file path that contains the list of file systems to exclude from the backup.
One file system mount point is listed per line.
Can be used if action=create.
- remain_nim_client (optional, bool, False)
Specifies to remains NIM client after the mksysb installation.
The /.rhosts and /etc/niminfo files are copied to the alternate rootvg’s file system.
Can be used if action=restore or type=mksysb.
- import_vg (optional, bool, False)
Specifies to look for and import volume groupe found in mksysb backup image.
Can be used if action=restore or type=mksysb.
- debug (optional, bool, False)
Specifies the debug mode (that is the set -x output).
Can be used if action=restore or type=mksysb.
- bootlist (optional, bool, True)
Specifies to run the bootlist command after the mksysb installation.
Cannot be used if flags contains the
-r
flag.Can be used if action=restore or type=mksysb.
- force (optional, bool, False)
Specifies to overwrite existing backup image.
Can be used if action=create and type=savevg.
- exclude_data (optional, bool, False)
If action=create, specifies to exclude user data from the backup. Backs up user volume group information and administration data files. This backs up files such as /tmp/vgdata/vgname/vgname.data and map files if any exist. Cannot be used on a rootvg.
If action=restore, specifies to recreate the volume group structure only without restoring any files or data.
Can be used if type=savevg.
- exclude_packing_files (optional, bool, False)
Specifies to exclude files specified in the /etc/exclude_packing.rootvg, /etc/exclude_packing.vgname, or /etc/exclude_packing.WPARname file from being packed.
Can be used if action=create and type=mksysb.
- exclude_files (optional, bool, False)
Specifies to exclude files specified in the /etc/exclude.vgname file from being backed up.
The /etc/exclude.vgname file should contain patterns of file names that you do not want included in your system backup image. They are input to the pattern matching conventions of the grep command.
Can be used if action=create.
- extend_fs (optional, bool, False)
Specifies to extend the filesystem if needed.
Can be used if action=create.
- minimize_lv_size (optional, bool, False)
Specifies to create the logical volumes with minimum size possible to accomodate the file system.
Can be used if action=restore and type=savevg.
- verbose (optional, bool, False)
Specifies to run the operation in verbose mode.
Can be used if action=create or action=restore.
Notes¶
Note
restore
mksysb
operation can be long, one can use the default log file /var/adm/ras/alt_disk_inst.log to track progress.savevg
only backs up varied-on volume group. The file systems must be mounted.savevg
backs up all logical volume information and will be recreated. However, only JFS-mounted file system data will be backed up. Raw logical volume data will NOT be backed up using a savevg.savevg
only backs up varied-on volume group. The file systems must be mounted.This backup module only operates on LPAR, for operation on VIOS, please checkout the backupios module in the power-vios collection.
You can refer to the IBM documentation for additional information on the commands used at U(https://www.ibm.com/support/knowledgecenter/ssw_aix_72/a_commands/alt_disk_mksysb.html, U(https://www.ibm.com/support/knowledgecenter/ssw_aix_72/l_commands/lsmksysb.html, U(https://www.ibm.com/support/knowledgecenter/ssw_aix_72/m_commands/mksysb.html, U(https://www.ibm.com/support/knowledgecenter/ssw_aix_72/r_commands/restvg.html, U(https://www.ibm.com/support/knowledgecenter/ssw_aix_72/s_commands/savevg.html.
Examples¶
- name: backup the rootvg with mksysb
backup:
action: create
type: mksysb
location: /tmp/backup_rootvg
exclude_files: false
extend_fs: yes
- name: install the mksysb image to /dev/hdisk1 using the 64 bits kernel if possible
backup:
action: restore
type: mksysb
location: /ESSAI/backup_datavg
disk: /dev/hdisk1
flags: '-K'
- name: savevg of rootvg to /dev/hdisk1
backup:
action: create
type: savevg
name: rootvg
location: /dav/rmt1
exclude_data: no
exclude_files: no
exclude_fs: /tmp/exclude_fs_list
create_data_file: yes
extend_fs: yes
verbose: yes
- name: savevg of datavg structure to /dev/hdisk2
backup:
action: create
type: savevg
name: datavg
location: /tmp/backup_datavg
exclude_data: yes
exclude_files: yes
create_data_file: yes
- name: view the vg backup image stored on /dev/hdisk1 with savevg
backup:
action: view
type: savevg
location: /dev/hdisk1
- name: restvg to restore datavg structure only to /dev/hdisk2
backup:
action: restore
type: savevg
name: datavg
location: /tmp/backup_datavg
data_file: /tmp/datavg.mydata
exclude_data: yes
minimize_lv_size: yes
flags: '-n'
Return Values¶
- msg (always, str, AIX create backup operation successfull.)
The execution message.
- cmd (when the command is run., str, /bin/restvg -f /dev/rmt0 -l)
The command executed.
- stdout (always, str, hdisk1 lv00 x 11 ./tmp/vgdata/datavg/image.info x 127 ./tmp/vgdata/vgdata.files11928014 x 127 ./tmp/vgdata/vgdata.files x 2320 ./tmp/vgdata/datavg/filesystems x 1530 ./tmp/vgdata/datavg/datavg.data x 278 ./tmp/vgdata/datavg/backup.data total size: 4393)
The standard output of the command.
stderr (always, str, Will create the Volume Group: datavg Target Disks: Allocation Policy: Shrink Filesystems: yes Preserve Physical Partitions for each Logical Volume: no New volume on /tmp/datavg_backup: Cluster 51200 bytes (100 blocks). Volume number 1 Date of backup: Thu Aug 6 03:53:53 2020 Files backed up by name User root files restored: 6)
The standard error of the command.
- rc (always, int, 0)
The return code of the command.
Equal -1 when the command has not been run.