O/S : Aix, Linux
Save system filesystems information in order to recreate them from scratch.
[ -v -h ]
[ -d 0-9 ]
- This script save filesystem information in order to recreate them from scratch.
- It is run daily by the 'sadm_client_sunset.sh' script.
- The output file is use to recreate all the system filesystem in a disaster recovery situation.
- 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 is use by "sadm_dr_recreatefs.sh" script to recreate all filesystems of the specified VG, with the proper permission.
Output when running the script
Example of the file produced :
Starting sadm_dr_savefs.sh V2.7 - SADM Lib. V2.52
Server Name: holmes.maison.ca - 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 sadm_dr_savefs.sh
On Aix :
root@holmes:/sadmin/bin$ cat /sadmin/dat/dr/holmes_fs_save_info.dat
# SADMIN - Filesystem Info. for system holmes.maison.ca
# File was created by sadm_dr_savefs.sh on Tue Nov 20 14:00:30 EST 2018
# This file is use in a Disaster Recovery situation
# The data below is use by sadm_dr_recreatefs.sh to recreate filesystems
- 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 sadm_dr_recreatefs.sh 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.
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').
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
- 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 mentionning that raw devices are included in the backup and will be restore by the sadm_dr_recreatefs.sh script.
Both of the files created are quite small, since no users files is included in the backup, only the metadata.
root@aixb50(/sadmin/dat/dr)# file aixb50_datavg.savevg
aixb50_datavg.savevg: backup/restore format file
The script make sure that an exclude file (/etc/exclude.VGNAME) exist for each VG and
that it contain this line ".*".
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
- 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.
    An exit status of zero indicates success
    Failure is indicated by a nonzero value, typically ‘1’.
Jacques Duplessis (email@example.com.).
Any suggestions or bug report can be sent at
Copyright © 2018 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.
(Recreate Filesystems from the information save by the "sadm_dr_savefs.sh" script)
(Daily end of the day script)
- Specify debug level (0-9).
Value of 0 indicate that no debug information is to be displayed.
- Display this help and exit.
- Output version information and exit.
- EXIT STATUS
- SEE ALSO