Skip to main content

File (CLI) Restore on AhsayOBM

  1. To restore files that have been backed up from your backup destination, you need to use the Restore.sh script by using a text editor like “vi” to configure the following restore settings:

    • BACKUP_SET - the backup set name
    • DESTINATION - the backup destination path
    • RESTORE_TO - the path of the restored files
    • RESTORE_FROM - the path of the files/folders to be restored
    • POINT_IN_TIME - the snapshot to be restored
    • RESTORE_PERMISSION - applies the original permission to the restore files
    • TEMP_DIR - the path where restore files will be stored temporarily
    • VERIFY_CHKSUM - verifies the in-file delta file checksum during restore
    
    # cd /usr/local/obm/bin
    # vi Restore.sh
    # !/bin/sh
    ################################# Restore.sh #################################
    # You can use this shell script to restore backup files using command-line. #
    # Just customize the "User Define Section" below with values for your restore #
    # action. #
    ################################################################################
    ######################### Start: User Defined Section ########################
    # ------------------------------- BACKUP_SET ---------------------------------
    # | The name or ID of the backup set that you want to restore. 					|
    # | If backup set name is not in English, please use ID instead. 				|
    # | e.g. BACKUP_SET="1119083740107" 											|
    # | or BACKUP_SET="FileBackupSet-1" 											|
    # | 																			|
    # | You can leave this parameter blank if you have only 1 backup set. 			|
    # ------------------------------------------------------------------------------
    BACKUP_SET="BackupSet-1"
    # ------------------------------ DESTINATION ---------------------------------
    # | The name or ID of the backup destination that you want to restore from. 	|
    # | If backup destination name is not in English, please use ID instead.		|
    # | e.g. DESTINATION="1740107119083" 											|
    # | or DESTINATION="Destination-1" 												|
    # | 																			|
    # | You can leave this parameter blank if you have only 1 destination. 			|
    # ------------------------------------------------------------------------------
    DESTINATION="AhsayCBS"
    # ------------------------------- RESTORE_TO ---------------------------------
    # | Directory to where you want files to be restored 							|
    # | set to "" to restore files to original location							 	|
    # | e.g. RESTORE_TO="/tmp" 														|
    # ------------------------------------------------------------------------------
    RESTORE_TO="/root/restore"
    # ------------------------------ RESTORE_FROM --------------------------------
    # | File/Directory on the backup server that you would like to restore 			|
    # | e.g. RESTORE_FROM="/Data" 													|
    # ------------------------------------------------------------------------------
    RESTORE_FROM="/root/Documents"
    # ----------------------------- POINT_IN_TIME --------------------------------
    # | The point-in-time snapshot (successful backup) that you want to restore 	|
    # | from the backup server. Use "Current" for the latest backup snapshot 		|
    # | e.g. POINT_IN_TIME="2006-10-04-12-57-13" 									|
    # | or POINT_IN_TIME="Current" 													|
    # | 																			|
    # | You can retrieve the point in time by using the ListBackupJob.sh 			|
    # ------------------------------------------------------------------------------
    POINT_IN_TIME="Current"
    # -------------------------- RESTORE_PERMISSION ------------------------------
    # | set to "Y" if you want to restore file permissions 							|
    # | set to "N" if you do NOT want to restore file permissions 					|
    # ------------------------------------------------------------------------------
    RESTORE_PERMISSION="N"
    # ---------------------------- SKIP_INVALID_KEY ------------------------------
    # | set to "Y" if you want to skip restore file with invalid key 				|
    # | set to "N" if you want to prompt user to input a correct key 				|
    # ------------------------------------------------------------------------------
    SKIP_INVALID_KEY="N"
    # ------------------------------ SYNC_OPTION ---------------------------------
    # | Delete extra files 															|
    # | set to "Y" if you want to enable sync option 								|
    # | set to "N" if you do NOT want to enable sync option 						|
    # | set to "" to prompt for selection 											|
    # ------------------------------------------------------------------------------
    SYNC_OPTION="N"
    # ------------------------- REPLACE_EXISTING_FILE ----------------------------
    # | set to "--all" to replace all existing file(s) of the same filename 		|
    # | set to "--none" to skip all existing file(s) with the same filename		 	|
    # | set to "" to prompt for selection 											|
    # ------------------------------------------------------------------------------
    REPLACE_EXISTING_FILE="--all"
    # ------------------------------ SETTING_HOME --------------------------------
    # | Directory to your setting home. 											|
    # | Default to ${HOME}/.obm when not set. 										|
    # | e.g. SETTING_HOME="${HOME}/.obm" 											|
    # ------------------------------------------------------------------------------
    SETTING_HOME=""
    # --------------------------------- FILTER -----------------------------------
    # | Filter out what files you want to restore 									|
    # | -Pattern=xxx-Type=yyy-Target=zzz 											|
    # | where xxx is the filter pattern, 											|
    # | yyy is the filter type, whice can be one of the following: 					|
    # | [exact | exactMatchCase | contains | containsMatchCase| 					|			
    # | startWith | startWithMatchCase | endWith | endWithMatchCase] 				|
    # | zzz is the filter target, which can be one of the following: 				|
    # | [toFile | toFileDir | toDir] 												|
    # |															 					|
    # | e.g. FILTER="-Pattern=.txt-Type=exact-Target=toFile" 						|
    # ------------------------------------------------------------------------------
    FILTER=""
    # -------------------------------- TEMP_DIR ----------------------------------
    # | Directory to where you want to store restore files temporarily 				|
    # | set to "" to use the temporary directory in the backup set 					|
    # | e.g. TEMP_DIR="/tmp" 														|
    # ------------------------------------------------------------------------------
    TEMP_DIR="/tmp"
    # ----------------------------- VERIFY_CHKSUM --------------------------------
    # | set to "Y" if you want to verify in-file delta file checksum during restore|
    # | set to "N" if you do NOT want to verify in-file delta file checksum during |
    # | restore 																	|
    # ------------------------------------------------------------------------------
    VERIFY_CHKSUM="N"
    ########################## END: User Defined Section #########################
    		
  2. After the Restore.sh script is configured, the files can be restored by running the Restore.sh script.

    
    # cd/usr/local/obm/bin
    # sh Restore.sh
    Using APP_HOME: : /usr/local/obm
    Using BACKUP_SET :
    Using RESTORE_FROM : /root/Documents
    Using RESTORE_TO : /root/restore
    Using POINT_IN_TIME : Current
    Using RESTORE_PERMISSION : N
    Using TEMP_DIR : /tmp
    Filter Pattern not set, filter would not apply to restore
    [2023-01-10 15:54:54] Start [ AhsayOBM v9.5.1.0 ]
    [2023-01-10 15:54:54] OS: Linux 4.18.0-240.1.1.el8_3.x86_64
    (localhost.localdomain); CPU Model: VMware-Intel(R) Xeon(R) Gold 5218R CPU @
    2.10GHz,Intel(R) Xeon(R) Gold 5218R CPU @ 2.10GHz,Intel(R) Xeon(R) Gold 5218R CPU
    @ 2.10GHz,Intel(R) Xeon(R) Gold 5218R CPU @ 2.10GHz; Number of Processors: 4;
    Heap Size: 126.8 MB (Current) / 1.8 GB (Maximum); Physical Memory: 472.1 MB
    (Free) / 3.6 GB (Total)
    [2023-01-10 15:54:54] start,Start [ AhsayOBM v9.5.1.0 ],0,0,0,,0,0
    [2023-01-10 15:54:54] Selected job: 2023-01-10-15-54-42
    [2023-01-10 15:54:54] Selected source: [/root/Documents]
    [2023-01-10 15:54:54] Info: [followLink=false marshalTargetPath=false
    deleteForSync=false skipFaultKey=false verifyDeltaFileChecksum=false
    ignoreSegmentInfoCorruptedData=true restorePermission=false [RestoreLocation]
    type=RAW path=[/root/restore]]
    [2023-01-10 15:54:56] Creating new directory... "/root/restore"
    [2023-01-10 15:54:56] Creating new directory... "/root/restore/root"
    [2023-01-10 15:54:56] Creating new directory... "/root/restore/root/Documents"
    [2023-01-10 15:54:56] [117248709][SharedBlockRestore]
    /root/Documents/1655101104242/Local@1655101104785/index/index.db (135168)
    [2023-01-10 15:54:56] [117248709][SharedBlockRestore]
    /root/Documents/1655102817923/Local@1655102818424/index/index.db (135168)
    [2023-01-10 15:54:56] [117248709][SharedBlockRestore]
    /root/Documents/installation_script (5123)
    [2023-01-10 15:54:56] [117248709][SharedBlockRestore] /root/Documents/sample1.pdf
    (581407)
    [2023-01-10 15:54:56] [117248709][SharedBlockRestore] /root/Documents/sample1.ppt
    (912384)
    [2023-01-10 15:54:56] [117248709][SharedBlockRestore] /root/Documents/sample1.rtf
    (119710)
    [2023-01-10 15:54:56] [117248709][SharedBlockRestore] /root/Documents/sample1.txt
    (14615)
    [2023-01-10 15:54:56] [117248709][SharedBlockRestore] /root/Documents/sample1.xls
    (16384)
    [2023-01-10 15:54:56] [117248709][SharedBlockRestore] /root/Documents/sample2.pdf
    (65715)
    [2023-01-10 15:54:56] [117248709][SharedBlockRestore] /root/Documents/sample2.ppt
    (530432)
    [2023-01-10 15:54:56] [117248709][SharedBlockRestore] /root/Documents/sample2.rtf
    (1958)
    [2023-01-10 15:54:56] [117248709][SharedBlockRestore] /root/Documents/sample2.txt
    (2859)
    [2023-01-10 15:54:56] [117248709][SharedBlockRestore] /root/Documents/sample2.xls
    (7168)
    [2023-01-10 15:54:56] [117248709][SharedBlockRestore] /root/Documents/sample3.txt
    (3541)
    [2023-01-10 15:54:56] [117248709][SharedBlockRestore] /root/Documents/sample3.xls
    (13312)
    [2023-01-10 15:54:56] [117248709][SharedBlockRestore]
    /root/Documents/sample_640x360.avi (583572)
    [2023-01-10 15:54:56] [117248709][SharedBlockRestore]
    /root/Documents/sample_960x540.mkv (1319066)
    [2023-01-10 15:54:56] [117248709][SharedBlockRestore]
    /root/Documents/sample_960x540.mpg (751261)
    [2023-01-10 15:54:56] [117248709][SharedBlockRestore]
    /root/Documents/settings.sys (45392)
    [2023-01-10 15:54:57] Downloading...
    "/root/restore/root/Documents/installation_script" (Total 5 K bytes)
    [2023-01-10 15:54:57]
    file,/root/restore/root/Documents/installation_script,960,5123,1646040090000,,167
    3337297057,1673337297060
    [2023-01-10 15:54:57] Downloading... "/root/restore/root/Documents/sample1.pdf"
    (Total 567.78 K bytes)
    [2023-01-10 15:54:57]
    file,/root/restore/root/Documents/sample1.pdf,517776,581407,1639045733000,,167333
    7297081,1673337297082
    [2023-01-10 15:54:57] Downloading... "/root/restore/root/Documents/sample2.rtf"
    (Total 1.91 K bytes)
    [2023-01-10 15:54:57]
    file,/root/restore/root/Documents/sample2.rtf,800,1958,1639045886000,,16733372970
    84,1673337297085
    [2023-01-10 15:54:57] Downloading... "/root/restore/root/Documents/sample1.rtf"
    (Total 116.9 K bytes)
    [2023-01-10 15:54:57]
    file,/root/restore/root/Documents/sample1.rtf,9536,119710,1639560858000,,16733372
    97086,1673337297087
    [2023-01-10 15:54:57] Downloading... "/root/restore/root/Documents/sample1.xls"
    (Total 16 K bytes)
    [2023-01-10 15:54:57]
    file,/root/restore/root/Documents/sample1.xls,8432,16384,1639045803000,,167333729
    7088,1673337297090
    [2023-01-10 15:54:57] Downloading... "/root/restore/root/Documents/sample2.txt"
    (Total 2.79 K bytes)
    [2023-01-10 15:54:57]
    file,/root/restore/root/Documents/sample2.txt,1440,2859,1639045503000,,1673337297
    091,1673337297091
    [2023-01-10 15:54:57] Downloading... "/root/restore/root/Documents/sample1.txt"
    (Total 14.27 K bytes)
    [2023-01-10 15:54:57]
    file,/root/restore/root/Documents/sample1.txt,512,14615,1641355214000,,1673337297
    092,1673337297093
    [2023-01-10 15:54:57] Downloading... "/root/restore/root/Documents/sample2.xls"
    (Total 7 K bytes)
    [2023-01-10 15:54:57]
    file,/root/restore/root/Documents/sample2.xls,2016,7168,1639045806000,,1673337297
    093,1673337297094
    [2023-01-10 15:54:57] Downloading...
    "/root/restore/root/Documents/sample_640x360.avi" (Total 569.89 K bytes)
    [2023-01-10 15:54:57]
    file,/root/restore/root/Documents/sample_640x360.avi,583584,583572,1639045584000,
    ,1673337297105,1673337297106
    [2023-01-10 15:54:57] Downloading... "/root/restore/root/Documents/sample1.ppt"
    (Total 891 K bytes)
    [2023-01-10 15:54:57]
    file,/root/restore/root/Documents/sample1.ppt,718448,912384,1639045766000,,167333
    7297122,1673337297125
    [2023-01-10 15:54:57] Downloading... "/root/restore/root/Documents/sample3.txt"
    (Total 3.46 K bytes)
    [2023-01-10 15:54:57]
    file,/root/restore/root/Documents/sample3.txt,1824,3541,1639045510000,,1673337297
    126,1673337297127
    [2023-01-10 15:54:57] Downloading... "/root/restore/root/Documents/sample3.xls"
    (Total 13 K bytes)
    [2023-01-10 15:54:57]
    file,/root/restore/root/Documents/sample3.xls,3552,13312,1639045810000,,167333729
    7127,1673337297128
    [2023-01-10 15:54:57] Downloading... "/root/restore/root/Documents/settings.sys"
    (Total 44.33 K bytes)
    [2023-01-10 15:54:57]
    file,/root/restore/root/Documents/settings.sys,45440,45392,1639554810000,,1673337
    297129,1673337297130
    [2023-01-10 15:54:57] Downloading... "/root/restore/root/Documents/sample2.ppt"
    (Total 518 K bytes)
    [2023-01-10 15:54:57] Downloading...
    "/root/restore/root/Documents/sample_960x540.mkv" (Total 1.26 M bytes)
    [2023-01-10 15:54:57]
    file,/root/restore/root/Documents/sample2.ppt,417312,530432,1639045774000,,167333
    7297139,1673337297141
    [2023-01-10 15:54:57]
    file,/root/restore/root/Documents/sample_960x540.mkv,1319072,1319066,163904563200
    0,,1673337297140,1673337297141
    [2023-01-10 15:54:57] Downloading... "/root/restore/root/Documents/sample2.pdf"
    (Total 64.17 K bytes)
    [2023-01-10 15:54:57]
    file,/root/restore/root/Documents/sample2.pdf,52896,65715,1639045741000,,16733372
    97143,1673337297144
    [2023-01-10 15:54:57] Downloading...
    "/root/restore/root/Documents/1655102817923/Local@1655102818424/index/index.db"
    (Total 132 K bytes)
    [2023-01-10 15:54:57]
    file,/root/restore/root/Documents/1655102817923/Local@1655102818424/index/index.d
    b,3360,135168,1655102874000,,1673337297145,1673337297146
    [2023-01-10 15:54:57] Downloading...
    "/root/restore/root/Documents/sample_960x540.mpg" (Total 733.65 K bytes)
    [2023-01-10 15:54:57]
    file,/root/restore/root/Documents/sample_960x540.mpg,751264,751261,1639045662000,
    ,1673337297158,1673337297159
    [2023-01-10 15:54:57] Downloading...
    "/root/restore/root/Documents/1655101104242/Local@1655101104785/index/index.db"
    (Total 132 K bytes)
    [2023-01-10 15:54:57]
    file,/root/restore/root/Documents/1655101104242/Local@1655101104785/index/index.d
    b,3360,135168,1655101210000,,1673337297160,1673337297161
    [2023-01-10 15:54:58] Restore Completed Successfully
    [2023-01-10 15:54:58] end,RESTORE_STOP_SUCCESS,0,0,0,,0,0
    		
  3. Verify the files are restored.

    
    # ls -la /root/restore/root/Documents/
    total 4896
    dr-xr-x---. 4 root root 4096 Jan 10 15:54 .
    dr-xr-x---. 3 root root 23 Jan 10 15:54 ..
    dr-xr-x---. 3 root root 33 Jan 10 15:54 1655101104242
    dr-xr-x---. 3 root root 33 Jan 10 15:54 1655102817923
    -rw-r--r--. 1 root root 5123 Feb 28 2022 installation_script
    -rw-r--r--. 1 root root 581407 Dec 9 2021 sample1.pdf
    -rw-r--r--. 1 root root 912384 Dec 9 2021 sample1.ppt
    -rw-r--r--. 1 root root 119710 Dec 15 2021 sample1.rtf
    -rw-r--r--. 1 root root 14615 Jan 5 2022 sample1.txt
    -rw-r--r--. 1 root root 16384 Dec 9 2021 sample1.xls
    -rw-r--r--. 1 root root 65715 Dec 9 2021 sample2.pdf
    -rw-r--r--. 1 root root 530432 Dec 9 2021 sample2.ppt
    -rw-r--r--. 1 root root 1958 Dec 9 2021 sample2.rtf
    -rw-r--r--. 1 root root 2859 Dec 9 2021 sample2.txt
    -rw-r--r--. 1 root root 7168 Dec 9 2021 sample2.xls
    -rw-r--r--. 1 root root 3541 Dec 9 2021 sample3.txt
    -rw-r--r--. 1 root root 13312 Dec 9 2021 sample3.xls
    -rw-r--r--. 1 root root 583572 Dec 9 2021 sample_640x360.avi
    -rw-r--r--. 1 root root 1319066 Dec 9 2021 sample_960x540.mkv
    -rw-r--r--. 1 root root 751261 Dec 9 2021 sample_960x540.mpg
    -rw-r--r--. 1 root root 45392 Dec 15 2021 settings.sys