Other Guides

Backup and DR

Image-Based Backup Restoration: How to Recover a Backup to a Disk of a Smaller Size

Scheduled full-system backup is a must in the production environment. If something goes wrong with a system or your computer, you can restore the system to a working state on a working machine and get back to your tasks without downtime. Usually, the recovery process goes smoothly; you just deploy your old system on a destination computer and that’s all. However, there are some use cases that require additional actions.

One such use case is when you need to restore your system to a disk of a smaller size. For example, when you need to move from HDD to SSD, or your alternate computer has a smaller disk (one of our clients’ situation). Below, our system administrator and solution architect explain how to solve this issue when creating an image-based backup in MSP360 Managed Backup Service on Windows OS. All the tools used are Windows built-ins.

Restoring an Image-Based Backup to a Smaller Disk

The data on disk is stored in sectors – the smallest chunks of data on a hard disk. Each file has many sector units assigned to it. These sectors are not located near each other; they can be scattered around the disk. This is called fragmentation, and it is fragmentation that makes it difficult to shrink a partition to the desired size during restore.

It is also necessary to know that the image-based backup plan in Managed Backup Service backs up data by keeping the information about the placement of sectors on the drive, as well as the start offset of disk partitions. Thus, the backup preserves the disk fragmentation as is, with all its inefficiency. If the disk that you’re going to use for system recovery is smaller than the original one, there won’t be enough space for your fragmented system. Here are some measures that will help you to shrink the system before backing it up.

Tip 1. Defragmentation

Defragmentation picks up the file’s fragments and joins them all together, one by one. After it completes, the files in your computer’s storage become sequences of data blocks, and all the blocks that relate to a single file are located near each other. When possible, defragmentation also stocks all the “busy” blocks in a pile, dividing the disk into two parts: one that’s busy with data and one that’s free. Not only does this reduce the size of your system, but it also speeds up your computer. To run defragmentation, open the Start menu and type “defrag”. Windows will show the appropriate option: Defragment and Optimize Drives.

Please note: defragmentation can change the placement of a lot of sectors, even the ones that are for non-fragmented files. In this case, the next block-level backup can grow in size.

Disk Defragmentation Tool
However, in most cases, defragmentation is not enough to shrink a volume (but it is worth doing it to start with anyway).

Tip 2. Disabling System Files

There are system files that can be placed anywhere on the system partition, even in the middle of it, regardless of the space used. These files might appear as an obstacle to system shrinking. If the system is working properly, system files can be temporarily disabled. After a successful shrink or restore job, they must be re-enabled. Here is a list of these files:

  • Pagefile (pagefile.sys)

Pagefile (pagefile.sys)

  • Hibernation (hiberfil.sys) (execute cmd command: powercfg /h off)

Disabling Hibernation

Result of Turning Off Hibernation

  • System protection (system restore points)

Disabling System Protection

If you are not sure whether it is worth concerning yourself with system files, you can try to shrink the system disk itself. If the desired size is achieved by performing shrink in a working system, there’s no need to disable system files before running a full backup.

Please note: pagefile.sys is ignored during an image-based backup job; however, it can make it impossible to shrink the partition on a working system before performing a backup.

Tip 3. Lowering Disk Volume

Before starting the image-based backup, shrink the system partition in the source system to the desired size (e.g., to a size that fits your SSD) with the Disk Management tool (open Start menu and type “disk” ) and then perform a full backup. This version of the system will require less space so it will fit the smaller disk.

Shrinking Volume in Disk Management

Deploying Your System

By following these tips, you’ll get a system of the desired size. Now, all that is left to do is to create a bootable USB/ISO in the Managed Backup Service agent. You can find the appropriate option on the Home panel.

  New call-to-action

Creating a Recovery Disk in MSP360 Managed Backup Service

When you run the Restore Wizard using your USB or image of the system that you’ve backed up, there will be a step to select the partitions to restore. Here, you will be able to check whether you have done everything right.

Checking Partition Size
Checking SSD with the TRIM Feature

Windows 8.1 and Windows 10 can automatically determine the type of physical storage, and configure it appropriately. Still, it is better to double-check some settings to boost performance and avoid problems in the future.

When a user deletes some data, it is not removed from the drive. Instead, the area of the SSD that contains this data is marked as non-used. This happens due to the way solid state drives read and write information. The TRIM command tells the SSD that specific areas contain data that is no longer needed and can be removed. The next time the computer is idle, the Active Garbage Collection process will delete the data.

If an image backed up from an HDD drive was restored to an SSD drive, checking if the TRIM function is enabled can be very important, as keeping useless data lowers the performance. To launch a check, run the command prompt with administrator rights and execute the following command:

fsutil behavior query DisableDeleteNotify

 

If TRIM has been enabled for the drive, the output of the command should include the following line:

NTFS DisableDeleteNotify = 0 (Disabled)

The TRIM Command Enabled

If the result is 1, then enable TRIM on an SSD drive via the command below:

fsutil behavior set DisableDeleteNotify 0

 

In this case, the data that you remove from your SSD will be actually deleted at the next run of the Active Garbage Collection process.

Using these tips, you can significantly reduce the size of your system, so that you’ll be able to deploy it on a computer with a smaller disk. Do not forget that all the described actions should be performed before launching the image-based backup plan, otherwise they won’t work. If you have any further questions, please contact our pre-sales team.

MSP360 Managed Backup.
Simple. Reliable.
Powerful cross-platform backup and disaster recovery that leverages the public cloud to enable a comprehensive data protection strategy.
New call-to-action
MBS CTA image