Sunday, January 30, 2022

A Backup, Restore, and Update Tool with a refined approach



Let's face it, over the period number of files grow, change, removed, copied and moved etc. Keeping track of these will be a challenge unless they are backed up and tracked to restore when needed.

The Backup and Restore Tool discussed here has following features:

  • Create Backup collections and add / remove folders that will be backed up.
  • Add exclude folder list such as system folders. e.g., c:\window
  • Track files by CRC so that only a single copy of that file is stored.
  • Files are backed up to a password protected archive.
  • Each archive's metadata is also password protected.
  • During backup, an integrated view is presented where each folder is indicated as archived and partial , modified or changed.
  • During backup, an integrated view is presented where each file is indicated as archived and modified 
  • During restore, an integrated view is presented where each folder is indicated as same, deleted and changed 
  • During restore, an integrated view is presented where each file is indicated as same, deleted and changed 

Main
The following diagram illustrates the backup and Restore tool.

New
Creates new archive. The GUI is shown below.


Operation
  1. Enter a name for the archive. e.g., TechBlog
  2. select a location  for the archive. A new folder will be created under this folder to store contents of the archive. c:\archive\TechBlog.
  3. Enter a description for the archive
  4. Select folders to backup. e.g., d:\techblog. The checkbox of the folder to be backed up should be checked to take the backup.
  5. Folders that needs to be excluded from backup such as system folder can be specified in exclude.txt under the collection folder.
  6. After Clicking OK, user is asked to enter a password for the archive. This password is used for storing metadata of the archive.


Edit
Once the archive is created, edit can be used to add additional folders to backup or select deselect folders for taking backup.



Backup Tool

A collection is a set of folders that needs to be archived in multiple backups. Each backup contains a snapshot of the archived folders at the time backup was taken. 



Operation
  1. First select folders to backup as discussed above and Click Backup button
  2. An integrated view is presented to select files/folders and status of the file and folder items. 
The status of a file item can be as below.
  • New - New file. Never backed up.
  • Changed - Existing file changed after last backup. 
  • Archived - Existing file that didn't change since last backup.
Similarly the status of a folder item can be as below.
  • New New Folder. Never backed up.
  • Partial Existing folder structure changed since last backup. 
  • Archived  No changes since last backup

3. Finally, Check the checkboxes to choose the files that needs to be backed up. Click Backup Now button to start taking backups. The backups will be saved into a internally generated password protected 7zip file. 

 Restore Tool

The restore tool can be used to restore files from previously archived backup.

Operation
Select a backup from the dropdown list to restore.
Files are synched with disk if "sync with folders" is checked. This will compare the crc of the existing files with the previous backups and determine which files needed to be restored. 
Each file can have three states -  Same, Changed or Deleted.
  • Same means the file has not changed hence no restoration is needed.
  • Changed means the file has changed hence restoration is needed
  • Deleted means the file is deleted  hence restoration is needed
In the same way, A folder can have one of the three states -  Same, Changed or Deleted.
  • Same means the folder has not changed.
  • Changed means one or more files in the folder has changed hence restoration is needed.
  • Deleted means the entire folder is deleted  hence restoration is needed.

By default all the files from the previous backups are listed. If  changes only is checked, only files from the selected backup are listed.

If Hide Same is checked, all the unchanged items are removed from the display.

Export exports file  items listed to a csv file along with the crc.

Refresh Resyncs with disk for latest changes.

Finally, Check the checkboxes to choose the files that needs to be restored. Click Restore button to restore. As shown below, the files can be saved to a different folder or to the same original folder where they existed.



 Update Tool

It's a hybrid of Backup Tool and Restore Tool. The Update tool can be used to update previously archived backup. Folders and Files can be added and removed from the archive without having to use Backup Tool. This is helpful incase the original backup is not available.


Operation
Select a backup
Expand the tree and select the folder that receives files
Drag and drop files. after acknowledgement  files will be added automatically.




Source and Binaries can be found here.


Thursday, January 20, 2022

Desktop Virtualization of Released Software using Virtual Hard Disk

Software Applications in regulated domains  use customized  OS based  on an embedded OS such as WES7 or Win10 IOT. This is for restricting access and  also to provide a highly controlled environment.

The application software installation can be time consuming as it involves first formatting and installing the OS; then installing application software. With multiple releases of the software and limited resources, installation of an older release can be painful especially if it's DVD based due to wear and tear.

A Virtual Hard Disk or  VHD is nothing but a flat file  on the disk of host PC, which can be mounted as a Hard disk on the system with multiple partitions. Further a VHD can be made bootable by adding an entry to the boot menu. A VHD can be created using DiskMgmt control panel app or using diskpart.exe.


A VHD can come very handy where OS + Application can be pre-installed on a VHD. It simply can be mounted and made bootable on demand. In other words, a single PC can run multiple installations on demand without requiring an installation. The file can be even copied and deployed on a different but compatible PC.

Example
Consider a typical software application that runs on a customized embedded OS. The volume layout can be as below.
C:  OS + Application Software
D:  Data
 
Create a VHD
A VHD can be created using DiskMgmt control panel app or diskpart.exe. The example below creates a VHD with a matching volume layout as shown above.
After running the script, the VHD can be visualized as shown above  diskmgmt.msc

Load  OS into VHD
The next step is to format the active partition on the VHD and load OS into it using imagex command
Note that H: is the system partition as shown above.  This usually loads syspreped image of the OS
imagex /apply Installer.wim 1 H:

Make VHD bootable and make it default
bcdboot h:\windows
Boot files successfully created.
bcdedit /set {default} description "Some App 1.0"
The operation completed successfully.

Reboot
After reboot a new boot menu entry is added as shown below and is automatically selected to boot from.

Load Application Software
Once OS is installed, the Application software will be loaded as a part of the installation.


Source and Binaries can be found here.


Sunday, January 9, 2022

Using bootable Virtual Hard Drive as Media instead of USB Drive/DVD Disk

Installing commercial software having embedded OS  such as WES7 or Win10IOT, uses various types of media such as CD/DVD or USB. This is mainly because of deployment of custom Operating system. These type of installations cannot be automated because of  need of manual operations such as boot options, bios password etc.
A bootable Virtual Hard Disk( VHD) provides a perfect solution. Following describes the process in detail.
1. Duplicate the USB disk image into a Virtual Hard disk. For example, The VHD contains two partitions. The first is bootable partition containing WinPE OS. The second is Service Disk containing license files.
2. Load the OS
The OS Image in an USB has following structure:
The sources folder contains the boot.wim which is loaded by the OS. However for the VHD, the entire boot.wim should be extracted into the bootable drive.
In addition, customization of the scripting may be required for correct deployment. It can be done starting with modifying windows\system32\startnet.cmd file. This script is first that is executed.

3.Adding boot entry and make it default.
The last step is to add an boot entry to the VHD file. After adding the entry system is rebooted. The system loads bootable VHD drive and loads the WinPE OS the same way in case of an USB drive.
bcdboot u:\windows
Boot files successfully created.
bcdedit /set {default} description "Some App 1.0"
The operation completed successfully.

4.Reboot the system
After the system restarts, the system will automatically select the bootable vhd to start.


Source and Binaries can be found here.