5 minute read

Save system filesystems information in order to recreate them from scratch

SYNOPSIS [-d 0-9] [-h] [-v]
$SADMIN/bin/ - v2.8
Posted 2021-06-02 - Updated 2021-06-02
Supported on Linux
Can be executed on a client and on the SADMIN Server.


This script save filesystem information in order to recreate them from scratch in a disaster recovery situation. This script is part of the ‘’ script. The ‘client sunset script’ is scheduled to run daily from the client crontab (/etc/cron.d/sadm_client). The output file is use by to recreate all the system filesystem. This script is supported on Aix and Linux. Although it run on MacOS, it doesn’t produce anything (No lvm on MacOS).

On Linux :

The volume group(s) where the filesystems will be recreated, must be created prior to running this script. If the ‘lvm2’ package is not installed (lvm not used), the script inform the user and exit the script.

The ‘lvscan’ command output is used and each logical volume is process one by one. It gather all info needed to recreate the filesystem (or swap) needed in case of disaster recovery. The output file name “$SADMIN/dat/dr/[hostname]_fs_save_info.dat” is created with all info needed to recreate filesystems. Output file is sorted in order of mount point length (So that /abc if created before /abc/123). It’s use by “” script to recreate all filesystems of the specified VG, with the proper permission.

Output when running the script on Linux

Starting V2.7 - SADM Lib. V2.52
Server Name: - Type: LINUX
CENTOS 7.6.1810 Kernel 3.10.0-957.1.3.el7.x86_64

Verifying if 'lvm2' package is installed ...
[OK] lvm2 package is installed ...
There are 21 Logical volume reported by lvscan
Output file is /sadmin/dat/dr/holmes_fs_save_info.dat

Backup of /sadmin/dat/dr/holmes_fs_save_info.dat to /sadmin/dat/dr/holmes_fs_save_info.prev
Creating a new copy of /sadmin/dat/dr/holmes_fs_save_info.dat
[SUCCESS] Copying /sadmin/dat/dr/holmes_fstab to /sadmin/dat/dr/holmes_fstab.prev
[SUCCESS] Copying /etc/fstab to /sadmin/dat/dr/holmes_fstab

Script return code is 0
Script execution time is 00:00:04
Trim History /sadmin/dat/rch/holmes_sadm_dr_savefs.rch to 125 lines
Requested alert only if script fail (Won't send alert)
Trim log /sadmin/log/holmes_sadm_dr_savefs.log to 2000 lines
Fri Dec  7 11:03:12 EST 2018 - End of

Example of the output file produced :

# cat /sadmin/dat/dr/holmes_fs_save_info.dat

# SADMIN - Filesystem Info. for system
# File was created by on Tue Nov 20 14:00:30 EST 2018
# This file is use in a Disaster Recovery situation
# The data below is use by to recreate filesystems
# ---------------------------------------------------------------------

On Aix :

This script doesn’t save any information about the ‘rootvg’ volume group, we assume that it will be restore by the ‘mksysb’. Files produced are meant to be use by to recreate the volume group and the filesystems it contain.

It produce two files, this first is named $SADMIN/dat/dr/HOSTNAME_pvinfo.txt

  • In the output file, we have a list of all physical volumes with the name of the VG they belong
  • Along with that, we have disk space used by each VG and then the size of each physical volume.
hdisk0          000549ca5ae0508d                    rootvg          active      
hdisk1          000549ca5afe98bd                    None                        
hdisk2          0004d08c89dd230c                    nimvg           active      
Used space for nimvg: (15616 megabytes)     <<-------- Used space in 'nimvg'
hdisk0:140013                               <<-------- Size of hdisk0
hdisk1:140013                               <<-------- Size of hdisk1
hdisk2:140013                               <<-------- Size of hdisk2

By looking at the information above, we can say that the volume group ‘nimvg’ need a dedicated disk (or group of disk) with at least 15GB of free space to be restore.

The second file is a backup of the structure of each volume group (except ‘rootvg’). The backup file is in backup/restore format and is created in $SADMIN/dat/dr directory.

In the example below, the file was created on a server named ‘aixb50’, it contain the metadata of the volume group ‘datavg’ and have an extension of ‘.savevg’ It is worth mentioning that raw devices are included in the backup and will be restore by the script.

root@aixb50(/sadmin/dat/dr)# file aixb50_datavg.savevg
aixb50_datavg.savevg: backup/restore format file

Both of the files created are quite small, since no users files is included in the backup, only the metadata.

root@holmes:/sadmin/dat/dr$ ls -l batman_nimvg.savevg batman_pvinfo.txt
-rwxrwxr-x 1 apache apache 51200 Oct 29 11:30 batman_nimvg.savevg
-rwxrwxr-x 1 apache apache   325 Oct 29 11:30 batman_pvinfo.txt

The script make sure that an exclude file (/etc/exclude.VGNAME) exist for each VG and that it contain this line “.*”. This ensure that no file is taken in the backup of the VG (Only the structure metadata). These exclude file will be delete at the end of the backup. When the backup of a VG is done the line that was added in the exclude file is removed.

Back to the top


Options Description
[ -d 0-9 ] Set debug level from 0 to 9 (Default is 0)
[ -h ] Display this help and exit.
[ -v ] Output version information and exit.


  • The “$SADMIN” environment variable must be defined and contains the root directory of the SADMIN tools (normally /opt/sadmin). It should be already done, the setup script have updated the ‘/etc/profile.d/’ and the ‘/etc/environment’ files.
  • The SADMIN configuration file, is needed and loaded in memory at the beginning of every scripts. This file should already exist and contains your SADMIN configuration and preference setting.
  • For Shell script the Shell Library is used and for Python script the Python Library is used.


Exit Code Description
0 An exit status of zero indicates success.
1 Failure is indicated by a nonzero value, typically ‘1’.


Jacques Duplessis
Any suggestions or bug report can be submitted at the support page

Copyright © 2021 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later
This is free software, you are free to change and redistribute it.
There is NO WARRANTY to the extent permitted by law.


sadmin.cfg - SADMIN main configuration file - Clients end of day housekeeping and producing system information files - Purge old log,rch,nmon files and check $SADMIN permission - Collect hardware & software information about the system
System Information File - Documentation about the system information file - Save system filesystems information in order to recreate them from scratch. - Used metadata saved by ‘’ to recreate host filesystems - Get System information and creates a HTML web page of it.