Windows service volume shadow copy service

From Wikipedia, the free encyclopedia

From Wikipedia, the free encyclopedia

Shadow Copy

Previous Versions Vista.png

Previous Versions in Windows Vista, a part of Windows Explorer that allows persistent shadow copies to be created.

Other names
  • Volume Snapshot Service[1]
  • Previous Versions
  • Shadow Copies for Shared Folders8
  • VSS[2]
Developer(s) Microsoft
Operating system Microsoft Windows
Service name VSS[2]

Shadow Copy (also known as Volume Snapshot Service,[1] Volume Shadow Copy Service[2] or VSS[2]) is a technology included in Microsoft Windows that can create backup copies or snapshots of computer files or volumes, even when they are in use. It is implemented as a Windows service called the Volume Shadow Copy service. A software VSS provider service is also included as part of Windows to be used by Windows applications. Shadow Copy technology requires either the Windows NTFS or ReFS filesystems in order to create and store shadow copies. Shadow Copies can be created on local and external (removable or network) volumes by any Windows component that uses this technology, such as when creating a scheduled Windows Backup or automatic System Restore point.

Overview[edit]

VSS operates at the block level of volumes.

A snapshot is a read-only point-in-time copy of the volume. Snapshots allow the creation of consistent backups of a volume, ensuring that the contents do not change and are not locked while the backup is being made.

The core component of shadow copy is the Volume Shadow Copy service, which initiates and oversees the snapshot creation process. The components that perform all the necessary data transfer are called providers. While Windows comes with a default System Provider, software and hardware vendors can create their own software or hardware providers and register them with Volume Shadow Copy service. Each provider has a maximum of 10 seconds’ time to complete the snapshot generation.[3]

Other components that are involved in the snapshot creation process are writers. The aim of Shadow Copy is to create consistent reliable snapshots. But sometimes, this cannot simply be achieved by completing all pending file change operations. Sometimes, it is necessary to complete a series of inter-related changes to several related files. For example, when a database application transfers a piece of data from one file to another, it needs to delete it from the source file and create it in the destination file. Hence, a snapshot must not be between the first deletion and the subsequent creation, or else it is worthless; it must either be before the deletion or after the creation. Enforcing this semantic consistency is the duty of writers. Each writer is application-specific and has 60 seconds to establish a backup-safe state before providers start snapshot creation. If the Volume Shadow Copy service does not receive acknowledgement of success from the corresponding writers within this time-frame, it fails the operation.[3]

By default, snapshots are temporary; they do not survive a reboot. The ability to create persistent snapshots was added in Windows Server 2003 onward. However, Windows 8 removed the GUI portion necessary to browse them. (§ History)

Windows software and services that support VSS include Windows Failover Cluster,[4] Windows Server Backup,[5] Hyper-V,[6] Virtual Server,[7] Active Directory,[8] SQL Server,[9] Exchange Server[10] and SharePoint.[11]

The end result is similar to a versioning file system, allowing any file to be retrieved as it existed at the time any of the snapshots was made. Unlike a true versioning file system, however, users cannot trigger the creation of new versions of an individual file, only the entire volume. As a side-effect, whereas the owner of a file can create new versions in a versioning file system, only a system administrator or a backup operator can create new snapshots (or control when new snapshots are taken), because this requires control of the entire volume rather than an individual file. Also, many versioning file systems (such as the one in VMS) implicitly save a version of files each time they are changed; systems using a snapshotting approach like Windows only capture the state periodically.

History[edit]

This section needs to be updated. Please help update this article to reflect recent events or newly available information. (August 2015)

Windows XP and Server 2003[edit]

Volume Snapshot Service was first added to Microsoft Windows in Windows XP. It can only create temporary snapshots, used for accessing stable on-disk version of files that are opened for editing (and therefore locked). This version of VSS is used by NTBackup.

The creation of persistent snapshots (which remain available across reboots until specifically deleted) has been added in Windows Server 2003, allowing up to 512 snapshots to exist simultaneously for the same volume. In Windows Server 2003, VSS is used to create incremental periodic snapshots of data of changed files over time. A maximum of 64 snapshots are stored on the server and are accessible to clients over the network. This feature is known as Shadow Copies for Shared Folders and is designed for a client–server model.[12] Its client component is included with Windows XP SP2 or later, and is available for installation on Windows 2000 SP3 or later, as well as Windows XP RTM or SP1.[13]

vssadmin

Developer(s) Microsoft
Stable release

1.1

Operating system Microsoft Windows
Type Command
License Proprietary commercial software
Website docs.microsoft.com/en-us/windows-server/administration/windows-commands/vssadmin

Windows XP[14] and later include a command line utility called vssadmin that can list, create or delete volume shadow copies and list installed shadow copy writers and providers.[15]

Windows Vista, 7 and Server 2008[edit]

Microsoft updated a number of Windows components to make use of Shadow Copy. Backup and Restore in Windows Vista, Windows Server 2008, Windows 7 and Windows Server 2008 R2 use shadow copies of files in both file-based and sector-by-sector backup. The System Protection component uses VSS when creating and maintaining periodic copies of system and user data on the same local volume (similar to the Shadow Copies for Shared Folders feature in Windows Server); VSS allows such data to be locally accessed by System Restore.

System Restore allows reverting to an entire previous set of shadow copies called a restore point.[16][17]
Prior to Windows Vista, System Restore depended on a file-based filter that watched changes for a certain set of file extensions, and then copied files before they were overwritten.[18][19][20] In addition, a part of Windows Explorer called Previous Versions allows restoring individual files or folders locally from restore points as they existed at the time of the snapshot, thus retrieving an earlier version of a file or recovering a file deleted by mistake.

diskshadow

Developer(s) Microsoft
Operating system Microsoft Windows
Type Command
License Proprietary commercial software
Website docs.microsoft.com/en-us/windows-server/administration/windows-commands/diskshadow

Finally, Windows Server 2008 introduces the diskshadow utility which exposes VSS functionality through 20 different commands.[21]

The system creates shadow copies automatically once per day, or when triggered by the backup utility or installer applications which create a restore point.[22][23] The «Previous Versions» feature is available in the Business, Enterprise, and Ultimate editions of Windows Vista[24] and in all Windows 7 editions. The Home Editions of Vista lack the «Previous Versions» feature, even though the Volume Snapshot Service is included and running. Using third-party tools it is still possible to restore previous versions of files on the local volume.[25]
Some of these tools also allow users to schedule snapshots at user-defined intervals, configure the storage used by volume-shadow copies and compare files or directories from different points-in-time using snapshots.[26]
Windows 7 also adds native support through a GUI to configure the storage used by volume-shadow copies.

Windows 8 and Server 2012[edit]

While supporting persistent shadow copies, Windows 8 lacks the GUI portion necessary to browse them; therefore the ability to browse, search or recover older versions of files via the Previous Versions tab of the Properties dialog of files was removed for local volumes. However, using third party tools (such as ShadowExplorer) it is possible to recover that functionality. The feature is fully available in Windows Server 2012.[27]

Windows 10[edit]

Windows 10 restored the Previous Versions tab that was removed in Windows 8; however, in earlier builds it depended upon the File History feature instead of Volume Shadow copy. Current builds now allow restoration from both File History and System Protection (System Restore) points, which use Volume Shadow Copy.[28]

Samba Server[edit]

Samba on Linux is capable of providing Shadow Copy Service on an LVM-backed storage or with an underlying ZFS or btrfs.[29][30][31]

Compatibility[edit]

While the different NTFS versions have a certain degree of both forward and backward compatibility, there are certain issues when mounting newer NTFS volumes containing persistent shadow copies in older versions of Windows. This affects dual-booting, and external portable hard drives. Specifically, the persistent shadow copies created by Windows Vista on an NTFS volume are deleted when Windows XP or Windows Server 2003 mount that NTFS volume. This happens because the older operating system does not understand the newer format of persistent shadow copies.[32] Likewise, System Restore snapshots created by Windows 8 are deleted if they are exposed to a previous version of Windows.[33]

See also[edit]

  • List of Microsoft Windows components
  • Snapshot (computer storage)
  • Copy-on-write

References[edit]

  1. ^ a b «Volume Snapshot Service (VSS)». Glossary. Symantec. Retrieved 2 May 2013.
  2. ^ a b c d «Volume Shadow Copy Service Overview». MSDN Library. Microsoft. 5 November 2012. Retrieved 2 May 2013.
  3. ^ a b «How Volume Shadow Copy Service Works». TechNet. Microsoft. 28 March 2003. Retrieved 4 January 2011.
  4. ^ Archiveddocs. «What’s New in Failover Clusters in Windows Server 2008». technet.microsoft.com. Retrieved 18 March 2018.
  5. ^ JasonGerend. «Volume Shadow Copy Service». docs.microsoft.com. Retrieved 11 August 2019.
  6. ^ scooley. «Hyper-V Integration Services». docs.microsoft.com. Retrieved 11 August 2019.
  7. ^ scooley. «Microsoft Virtualization and Virtual Server 2005 R2 SP1». docs.microsoft.com. Retrieved 11 August 2019.
  8. ^ mcleanbyron. «VSS Backup and Restore of the Active Directory — Windows applications». docs.microsoft.com. Retrieved 11 August 2019.
  9. ^ MandiOhlinger. «SQL Server database mirroring, Volume Shadow Copy service and AlwaysOn — BizTalk Server». docs.microsoft.com. Retrieved 11 August 2019.
  10. ^ msdmaguire. «Exchange Server data protection, Exchange disaster recovery, Exchange backup, Exchange VSS Writer, VSS Backup Exchange, Exchange Server data recovery, Exchange data recovery». docs.microsoft.com. Retrieved 11 August 2019.
  11. ^ spdevdocs. «Back up and restore a search service application in SharePoint using VSS». docs.microsoft.com. Retrieved 11 August 2019.
  12. ^ «Shadow Copy Client Download». TechNet. Microsoft. Retrieved 21 October 2014.
  13. ^ Oltean, Adi (17 December 2004). «Tips for deploying Shadow copies [sic] for Shared Folders». Antimail. Microsoft. Retrieved 21 April 2009.
  14. ^ «Windows XP — Volume Shadow Copy Service». MSDN. Microsoft. Retrieved 31 May 2013.
  15. ^ «Vssadmin». Windows Server 2008 and Windows Server 2008 R2 documentations. TechNet Library. Microsoft. 28 September 2007. Windows Server Commands, References, and Tools. Retrieved 27 March 2012.
  16. ^
    Compare:«Information about SPP folder in Windows vista». Microsoft Community. Microsoft. 20 August 2010. Retrieved 22 July 2015. SPP stand for Shared Protection Point and is used by windows to store information on restore point.
  17. ^
    Compare:
    Barreto, Jose (16 September 2009). «Diagnosing Failures in Windows Server Backup – Part 1 (VSS/SPP Errors)». Storage at Microsoft: The official blog of the Windows and Windows Server storage engineering teams. Microsoft Corporation. Retrieved 11 September 2017. […] the origin of the error is in an underlying layer such as Volume Shadow Copy Service (VSS), Shared Protection Point (SPP), or other applications that plug into VSS framework.
  18. ^ Russinovich, Mark E.; Solomon, David A. (2005). Microsoft Windows Internals: Microsoft Windows Server 2003, Windows XP, and Windows 2000 (4 ed.). Redmond, WA: Microsoft Press. pp. 706–711. ISBN 0-7356-1917-4.
  19. ^ «Windows Backup». Windows Vista portal. Microsoft. Archived from the original on 10 May 2007. Retrieved 11 January 2014.
  20. ^ Fok, Christine (September 2007). «A Guide to Windows Vista Backup Technologies». TechNet Magazine. Microsoft. Retrieved 11 January 2014.
  21. ^ «Diskshadow». Windows Server 2008 and Windows Server 2008 R2 documentations. TechNet Library. Microsoft Corporation. 28 September 2007. Windows Server Commands, References, and Tools. Retrieved 27 March 2012.
  22. ^ «Selected Scenarios for Maintaining Data Integrity with Windows Vista». TechNet. Microsoft Corporation.
  23. ^ «A Guide to Windows Vista Backup Technologies». Microsoft.
  24. ^ «Volume Shadow Copy and «Previous Versions» feature in Windows Vista». Microsoft Corporation.
  25. ^
    ShadowExplorer allows restoring lost or altered files
  26. ^
    TimeTraveler adds a timeline to Windows Explorer allowing the user to open, restore or compare files or directories from points-in-time
  27. ^ «Previous versions UI removed for local volumes (Windows)». Retrieved 17 November 2012.
  28. ^ «Bad User Agent detected». www.winhelp.us. Retrieved 18 March 2018.
  29. ^ «Samba HOWTO Collection, Part III. Advanced Configuration». Retrieved 2 October 2012.
  30. ^ «zfsonlinux/zfs-auto-snapshot». GitHub. Retrieved 18 March 2018.
  31. ^ «[GUIDE] Windows Previous Versions and Samba (Btrfs — Atomic COW — Volume Shadow Copy)». openmediavault.
  32. ^ «How restore points and other recovery features in Windows Vista are affected when you dual-boot with Windows XP». File Cabinet Blog. Microsoft. 14 July 2006. Archived from the original on 18 July 2006. Retrieved 21 March 2007.
  33. ^ «Calling SRSetRestorePoint». MSDN Library. Microsoft. Retrieved 1 February 2015. Snapshots of the boot volume created by System Restore running on Windows 8 may be deleted if the snapshot is subsequently exposed by an earlier version of Windows.

Further reading[edit]

  • Russinovich, Mark E.; Solomon, David A.; Ionescu, Alex (2009). «Storage Management». Windows Internals (5th ed.). Microsoft Press. pp. 688–698. ISBN 978-0-7356-2530-3.
  • «Selected Scenarios for Maintaining Data Integrity with Windows Vista». Microsoft TechNet. Microsoft Corporation. Retrieved 4 January 2011.
  • Russinovich, Mark; Solomon, David (December 2001). «Windows XP: Kernel Improvements Create a More Robust, Powerful, and Scalable OS». TechNet Magazine. Microsoft. Retrieved 2 May 2013.
  • Oltean, Adi (19 September 2006). «A bit of black magic: How to assign drive letters to VSS shadow copies… on Windows XP!». Antimail. Microsoft Corporation. Retrieved 4 January 2011.
  • Oltean, Adi (14 December 2004). «Creating shadow copies from the commandline». MSDN Blogs. Microsoft Corporation. Retrieved 4 January 2011.
  • «Volume Shadow Copy Service (VSS) Express Writers». Microsoft Corporation.

Using Microsoft’s Volume Shadow Copy Technology for Consistent Backups

When creating a backup of a virtual or physical machine with running applications, especially applications that intensively write data to files and databases, ensuring backup data consistency is essential. Having consistent backup data facilitates recoveries without data corruption or delays. For this purpose, Microsoft developed the VSS technology.

This blog post explains what Volume Shadow Copy Service (VSS) is, how it works, and why this technology is important for backing up Windows-based virtual and physical machines.

Content

  • What Is Volume Shadow Copy?
  • How Volume Shadow Copy Service Works
  • How Is a Shadow Copy Created?
  • How VSS Works in NAKIVO

Protect physical Windows machines with NAKIVO

Back up running Windows servers and workstations to onsite, offsite and to the cloud. Recover machines and application objects in minutes. With NAKIVO, you can easily maintain production continuity with the tightest RTOs even in a mixed IT infrastructure. Discover NAKIVO’s solution.

Volume Shadow copy Service (VSS), a native feature of Windows operating systems, facilitates the creation of consistent application-aware backups. To achieve backup data consistency, the following happens:

  • VSS temporarily stops writing operations performed by applications.
  • Buffers from memory are written to disk, that is, flushed and the file system is frozen.
  • A volume snapshot, also called a shadow copy, is created in the Windows operating system.

Volume Shadow Copy, also referred to as Volume Snapshot Service, is a set of COM (Component Object Model) interfaces in Windows, which provide the framework to create consistent backups for different applications. VSS was first released with Windows XP and Windows Server 2003.

Why You Need the VSS Technology

Application data consistency is important for VM and physical server backups. Consistency guarantees that the applications running on virtual or physical machines are fully functional after they are restored from a backup.

Without VSS, you get an inconsistent backup. Such a backup is created by just copying each block in the state that it is in at the time of being copied. Suppose that a file is continuously used by an application such as a database or a system application. This application is continuously changing data in the opened file by writing/deleting blocks. While the first part of the file is being copied, blocks used by other parts of the file are changing. By the time the other parts of the file are copied to the backup repository, the blocks in the first part have changed. What you get is data blocks that are not consistent and do not represent a single specific point in time.

One way to avoid this situation is snapshot-based VM backup. When the backup process starts, a snapshot, that is, an exact copy of the VM, is taken. During this process, all VM disks (which are represented as .vmdk files in VMware environments) become read-only. To store the changes made during the backup process on the master disk, VMware ESXi creates a delta file connected to the main .vmdk file. After the delta file is created, the backup software starts copying data from the read-only .vmdk file. Once the backup process is completed, the delta file is merged with the .vmdk file.

This approach may work well for file systems with not a very high load, such as internal file storage or web servers. However, if the backup process starts at the moment when certain transactions are running, and I/O (input/output) operations are in place, data may be lost. When you are using applications or databases like Microsoft SQL Server, Active Directory, or Exchange Server, you cannot just close the file and then append data to it. Here, Volume Shadow Copy Service (VSS) can help. This technology allows creating point-in-time copies of files that are open and in use without compromising integrity and usability of these copies.

How Volume Shadow Copy Service Works

To understand how VSS works, we first need to go over the components that make up this feature. The high-level components of VSS are:

  • The VSS provider is the core component of VSS, which creates shadow copies (snapshots) of volumes. The VSS provider can have a software or hardware implementation. The copy-on-write software VSS provider is included in the Windows OS. Hardware providers are usually used with SAN storage (storage area network). Hardware providers offload the host OS when creating a shadow copy.
  • The writers are software components that write data to files and databases to ensure consistency. Each application with VSS support adds its writer to the operating system during installation. Examples of applications providing a VSS writer are Microsoft SQL Server and Exchange Server.
  • The requestor is a software component that commands the VSS provider to start or stop working (creating, deleting, or importing shadow copies). The requestor could be native Windows components (like NTBackup or Snapshot Manager for Hyper-V) or a third-party application like backup software.
  • The VSS service is an OS component that ensures that all the other components can communicate and work with each other.

How does VSS work?

Snapshots are taken at the volume level, and VSS operates with blocks (and blocks are used by files). That is why you cannot take snapshots of files or folders. A shadow copy can be stored on the same volume or on another volume. The place on a volume allocated to storing shadow copies is called a diff area.

The System Volume Information folder is used to store VSS shadow copy files. The files have the identifiers like 3517271a-d214-3a47-c5ea-01137a4fe675.

The VSS technology can be used as a Windows native tool to save point-in-time copies (snapshots) of disk volumes. The copies allow you to revert changes and go back to the saved state of the entire volume or particular files. Nevertheless, creating a true backup to be saved on an external medium is recommended for more reliable data protection.

VSS is an incremental procedure – Windows can create multiple volume snapshots one after another. After creating the first shadow copy, VSS tracks changes on disks by dividing data into 16-KB blocks. If there are changes on the disk, the service writes this entire block to a shadow copy. As a result, there is no need to copy the full data set with every new snapshot, and only changed blocks are copied.

Main VSS requirements and limitations:

  • At least 300 MB of disk space is required to create VSS snapshots.
  • The maximum number of volume snapshots is 64 by default.
  • 10% of volume space is allocated for shadow copies by the Windows system.

Note that VSS snapshots that are triggered by a backup application are usually deleted after the backup job is completed.

Native tools to manage VSS shadow copies

You can use Windows native tools to manage volume shadow copies. Knowing how they work with snapshots can help understand the VSS technology better and troubleshoot possible issues (for example, a temporary VSS snapshot not deleted after creating a completed backup).

Some VSS options are available in the Windows GUI, but all options are accessible in the command line, which is more interesting for us. There are two VSS tools you can use in Windows PowerShell or CMD:

  • vssadmin – available on all Windows versions starting from Windows XP (including Windows 10) and except Windows 8.
  • diskshadow – available only on Windows Server versions. This is an advanced implementation of vssadmin, which allows you not only to work in the interactive mode but also to create scripts.

Note that these two utilities are different and work in different contexts. A shadow copy created in vssadmin cannot be managed in diskshadow and vice versa. You can see the snapshot created with a different tool, but you cannot do any actions with it.

Volume Shadow Copy Service API is available to allow backup applications to use VSS and create application-aware backups for backup data consistency.

VMware VMs running Windows use the VMware VSS component as a VSS driver in a guest Windows operating system for quiescing. The driver is installed when you install VMware Tools. In other cases, when using old Windows versions, a SYNC driver is used. Here’s a list of supported guest operating systems for application-aware quiescing in VMware environments.

How a Shadow Copy Is Created

Once a shadow copy (volume snapshot) is created, its size is 0 bytes. When new data is written, the data is written on the disk (where it usually should be), but the old data is written to a shadow copy so you can restore that old data later. The size of the shadow copy grows as a result.

There are two main approaches to writing data when creating a snapshot:

  • Redirect on write (RoW): Writing new blocks to a snapshot (shadow copy) and saving metadata with information to which blocks on the disk they must be written. This approach involves fast writing of data but slow reading of data. If you need to roll back to the initial state when the snapshot was created, it takes a few seconds by deleting a snapshot (near instantly). The RoW approach is used to create snapshots of VM virtual disks (VMDK) in VMware ESXi and VMware Workstation.
  • Copy on Write (CoW): Writing new blocks to the needed place on the disk and sending the contents of rewritten blocks to a snapshot. Writing is slow, but reading is fast. Previous snapshots (previous data states) are deleted in a few seconds (near instantly). The CoW approach is used for VSS snapshots.

With so many different applications that can write data on disks, Microsoft created a unified interface with VSS to notify all applications that a snapshot is about to be created after initiating snapshot creation. The idea of the notification message is: A system will create a snapshot – stop your writing activities and flush writing buffers on disks to adopt the data into the consistent state.

The workflow to create a VSS snapshot is as follows:

  1. The VSS requestor checks the available services with which it can communicate, enumerates the writers, and gathers the metadata.
  2. After collecting a list of writers, the requestor communicates with the VSS provider and tells a snapshot which data it wants to create and where the snapshot should be located. In most cases, the snapshot is located on the same volume on the original disk. In alternative cases, SAN hardware providers can create a separate volume for a snapshot called a storage snapshot.
  3. Preparing for backup. This step involves requesting the real status of VSS writers (after getting the metadata) and preparing for the most important operation when writers must act one after another. Writers are notified that they must prepare for snapshot creation. The system buffer is flushed, and the application is frozen to ensure that a consistent data copy can be made. Each writer must fit in its allotted time of 60 seconds by default. Microsoft Exchange Server has only 20 seconds for this operation (this time is set by Microsoft).

Note: 20 seconds is a short period. If an application cannot fit in this time, the writers return an error, and the snapshot is not taken. If the storage performance is not enough to fit in this time limit, you can try upgrading your hardware to fix this issue. For example, you can change HDD to SSD storage devices. Alternatively, you can try to migrate other workloads to another storage and use dedicated storage only for the machine running Microsoft Exchange Server. Check logs to detect which writer failed the snapshot creation task.

  1. If everything is OK, and system activity is frozen, then VSS tells that the provider can create a shadow copy. There are only 10 seconds to create a snapshot. File system I/O requests are temporarily unavailable during this period. This is the time when you can also create a VM snapshot. Once the 10 seconds pass, all writers are unfrozen and input/output (I/O) operations are alive again.

Note: If the VSS providers take longer than 10 seconds to commit the shadow copy, the operation fails.

  1. VSS tells the writers that applications can unfreeze I/O requests and continue writing data to disks. If we use a backup application and a backup using the Windows VSS service has been created, the VSS snapshot can be deleted. This operation can be performed by the backup application itself. Alternatively, you can delete a volume snapshot with diskshadow or vssadmin.

If you have VSS issues, a machine reboot can fix the issues in many cases when other methods don’t work. Some issues related to time limitations (for example, 10 seconds to create a snapshot) can be fixed by upgrading hardware, including disk devices, or by reducing loads.

Try to create a snapshot manually and check whether you fit the 20 seconds allotted (using Exchange Server as an example). In case of failure, reboot, reduce the loads, and try again.

Starting from Windows Server 2012, VSS supports SMB file shares in Windows. The VSS technology is very useful with file shares as files may be continuously written by users and applications, making share backups a challenge without VSS. NAKIVO Backup & Replication 10.7 supports file share backup.

How Volume Shadow Copy Service Works in NAKIVO’s Solution

We have explored how VSS works in general. Now let’s look at how the VSS technology works when creating VMware vSphere VM backups with dedicated backup software like NAKIVO Backup & Replication.

In a nutshell, the Volume Shadow Copy Service works as follows: The requestor initiates the VSS provider. The provider redirects the writers to write data into a log file and starts creating the volume snapshot. After the requestor sends the stop signal to the provider (usually after the snapshot is ready), it begins moving data from the log file to the volume.

In this case, NAKIVO Backup & Replication becomes a VSS requestor when backing up a VMware vSphere VM using VSS.

  1. Before the VM backup starts, the NAKIVO solution writes data via its VSS writer.

VSS writer services are working with applications

  1. As the backup starts, NAKIVO Backup & Replication requests the VSS provider to start working. The writer redirects data into the log file while the volume “freezes”.

VSS backup has been started

  1. NAKIVO Backup & Replication starts creating a snapshot on the VM layer. It might take anywhere from a few seconds to several minutes, depending on the VMFS storage load. During this time, the writer continues writing data to the log file.
  2. A snapshot of the VM was created successfully. NAKIVO Backup & Replication, as the requestor, sends the signal to the provider to stop working.

VM backup using VSS software is in process

  1. The VSS Provider moves changes from the log file to the volume. NAKIVO Backup & Replication copies the data block of the VM snapshot to the backup repository.

You can configure the application-aware mode for backup data consistency in the wizard at the Options step. This way you enable VSS in a machine running Windows for backing up of this machine.

The app-aware mode is used to enable VSS for VM backup

Conclusion

Volume Shadow Copy Service (VSS) is a great technology to keep VM backups consistent, but it works only on Windows-based machines. To create consistent backups for Linux-based machines, you should implement special pre-freeze and post-thaw scripts. NAKIVO solution also provides automated consistent backups for Linux servers and workstations.

Trade in your current data protection solution for NAKIVO Backup & Replication at special prices starting at $207/CPU socket (with a perpetual license) and find out first-hand why the NAKIVO solution is right for protecting your organization’s data. You can also download a free edition of the solution to try first.

Get free VMware VM protection for 1 year

Protect up to 10 VMware vSphere VMs for free with NAKIVO for 1 whole year. Get access to robust data protection capabilities, including flexible and reliable post-ransomware recovery without paying a penny. Download Free Edition.

19.02.2020 — Служба теневого копирования томов (VSS), утилиты VSSADMIN и DISKSHADOW

Продолжаем цикл полезных статей по работе с инструментами резервного копирования серверов на базе Windows Server. На этот раз речь пойдёт о службе теневого копирования и утилитах по работе с ней.

Служба теневого копирования тома (англ. Volume Shadow Copy Service, VSS) — служба операционной системы Windows, позволяющая копировать файлы, с которыми в данный момент времени ведется работа, включая системные и заблокированные файлы. Служба необходима для работы программы восстановление системы и программ архивации.

Для правильного выполнения операций резервного копирования и восстановления требуется тесное взаимодействие между приложениями резервного копирования, бизнес-приложениями, для которых выполняется резервное копирование, оборудованием и программным обеспечением управления хранением. Служба теневого копирования томов (VSS), которая появилась в Windows Server 2003, упрощает взаимодействие между этими компонентами, позволяя им лучше взаимодействовать между собой.

Как работает служба теневого копирования томов

Для нормальной работы VSS требуются следующие основные компоненты:

  • Компонент службы VSS операционной системы Windows, который позволяет другим компонентам правильно взаимодействовать друг с другом.
  • Служба VSS — программное обеспечение, запрашивающее фактическое создание теневых копий. Как правило, это приложение резервного копирования такие как система архивации данных Windows Server и приложение Data Protection Manager System Center. Сторонними инициаторами запросов VSS являются почти все программное обеспечение для резервного копирования, работающее в Windows.
  • Модуль записи VSS — компонент, обеспечивающий согласованность данных во время резервного копирования.
  • Поставщик VSS — компонент, который создает и поддерживает теневые копии.

На следующей схеме показано, как служба VSS координирует работу с запрашивающими сторонами, модулями записи и поставщиками для создания теневой копии тома.

Рис. 1

Создание теневой копии

Рис. 2

Чтобы создать теневую копию, инициатор запроса, модуль записи и поставщик выполняют следующие действия:

  1. Инициатор запроса запрашивает у служба теневого копирования томов перечисление модулей записи, собирает метаданные модуля записи и готовится к созданию теневого копирования.
  2. Каждый модуль записи создает XML-описание компонентов и хранилищ данных, для которых необходимо создать резервную копию, и предоставляет их для служба теневого копирования томов. Модуль записи также определяет метод восстановления, который используется для всех компонентов. В службе теневого копирования томов содержится описание модуля записи для инициатора запроса, в котором выбираются компоненты, для которых будет выполняться резервное копирование.
  3. Служба теневого копирования томов уведомляет все модули записи о подготовке данных для создания теневой копии.
  4. Каждый модуль записи подготавливает данные соответствующим образом. Когда данные готовы к теневому копированию, модуль записи уведомляет службу теневого копирования томов.
  5. Служба теневого копирования томов предписывает средствам записи временно заморозить запросы на запись операций ввода-вывода приложения (запросы ввода-вывода на чтение по-прежнему возможны) в течение нескольких секунд, необходимых для создания теневой копии тома или томов. Замораживание приложения не может длиться более 60 секунд. Служба теневого копирования томов очищает буферы файловой системы, а затем замораживает файловую систему, что обеспечивает правильную запись метаданных файловой системы и запись данных, подлежащих теневому копированию, в согласованном порядке.
  6. Служба теневого копирования томов дает команду поставщику создать теневую копию. Период создания теневой копии длится не более 10 секунд, в течении которых все запросы на запись в файловую систему остаются замороженными.
  7. Служба теневого копирования томов освобождает запросы ввода-вывода записи файловой системы.
  8. Служба VSS сообщает средствам записи о разморозке запросов ввода-вывода приложения. На этом этапе приложения могут возобновить запись данных на диск, на который выполняется теневое копирование.
  9. Инициатор запроса может повторить процесс (вернитесь к шагу 1) или уведомить администратора о необходимости повторить попытку позже.
  10. Если теневая копия создана успешно, служба теневого копирования томов возвращает сведения о расположении для теневой копии запрашивающей стороне. После того как VSS и приложения выполняют изменения, теневая копия становится доступна только для чтения.

После создания теневой копии служба VSS начинает отслеживать изменение данных на диске. VSS разбивает все данные на блоки по 16Кб каждый, и если данные в таком блоке были изменены, служба записывает в файл теневой копии этот блок целиком. Таким образом получается, что при создании следующей теневой копии данных система не копирует данные целиком, а только лишь блочные изменения.  Благодаря этому система теневого копирования позволяет существенно сэкономить место на диске. Теневые копии могут храниться на том же диске, на котором хранятся данные, либо на отдельном (решение для высоконагруженных систем с большой частотой изменения данных). Все файлы теневых копий хранятся в служебном каталоге System Volume Information. Эти файлы можно отличить по имени, все они содержат в имени идентификатор службы VSS — 3808876b-c176-4e48-b7ae-04046e6cc752.

Утилита VSSADMIN

Утилита VSSADMIN предназначена для администрирования в командной строке службы теневого копирования томов. С ее помощью создавать и удалять теневые копии, управлять хранилищами теневых копий, а также производить диагностику неисправностей модулей службы теневого копирования. Для работы с утилитой VSSADMIN запускаем командную строку от имени администратора, и введем команду vssadmin /?, после чего систем выведет список поддерживаемых команд. Познакомимся с возможностями утилиты и ее командами подробнее…

ADDSHADOWSTORAGE — создание новой ассоциации хранилищ теневых копий.

AddShadowStorage /For=ForVolumeSpec /On=OnVolumeSpec /MaxSize=MaxSizeSpec — добавление нового соответствия хранилищ теневых копий между томом ForVolumeSpec и томом хранилища теневых копий, который задан параметром OnVolumeSpec. Теневые копии ForVolumeSpec будут сохраняться на томе OnVolumeSpec.  Максимальный размер, который сопоставление может занимать на томе хранилища теневых копий, задается параметром MaxSizeSpec.  Если для параметра MaxSizeSpec установлено значение UNBOUNDED, размер хранилища теневых копий не ограничивается. При достижении максимально возможного числа сопоставления хранилищ теневых копий отображается сообщение об ошибке.  Параметр MaxSizeSpec может задаваться в байтах или в процентном отношении к размеру тома хранилища ForVolumeSpec.  Если параметр MaxSizeSpec задан в байтах, его значение должно быть не меньше 320MB; допускается использование следующих суффиксов: KB, MB, GB, TB, PB и EB.  Также допускаются суффиксы B, K, M, G, T, P и E.

      Чтобы задать значение параметра MaxSizeSpec в процентах, используйте знак % в качестве суффикса числового значения.  Если суффикс не задан, значение MaxSizeSpec задается в байтах.

Пример использования:

  • vssadmin Add ShadowStorage /For=C: /On=D: /MaxSize=900MB
  • vssadmin Add ShadowStorage /For=C: /On=D: /MaxSize=UNBOUNDED
  • vssadmin Add ShadowStorage /For=C: /On=C: /MaxSize=20%

CREATESHADOW — создание новой теневой копии тома.

CreateShadow /For=ForVolumeSpec [/AutoRetry=MaxRetryMinutes] — создание новой теневой копии для тома ForVolumeSpec. ForVolumeSpec должен представлять букву диска локального тома или точку подключения.  Если указан параметр MaxRetryMinutes и имеется другой процесс создания теневой копии, vssadmin будет продолжать попытки создать теневую копию в течение MaxRetryMinutes минут.

Примериспользования: vssadmin Create Shadow /For=C: /AutoRetry=2

DELETESHADOWS — удаление теневых копий тома.

Delete Shadows /For=ForVolumeSpec [/Oldest] [/Quiet]

Delete Shadows /Shadow=ShadowId [/Quiet]

Delete Shadows /All

Удаление всех соответствующих теневых копий для указанного тома ForVolumeSpec. Если указан параметр /Oldest, удаляется старейшая теневая копия на томе. Если указан параметр /All, на всех томах удаляются все теневые копии, которые можно удалить.  Если указан параметр /Shadow=ShadowId, удаляется теневая копия с заданным ID.  Могут быть удалены только теневые копии, имеющие тип ClientAccessible.

ID теневой копии можно получить с помощью команды List Shadows. Вводить ID теневой копии необходимо в следующем формате: {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}, где X представляет шестнадцатеричные знаки.  Этот ID можно получить с помощью команды List Shadows.

Пример использования: vssadmin Delete Shadows /For=C: /Oldest

DELETESHADOWSTORAGE — удаление ассоциации хранилищ теневых копий тома.

DeleteShadowStorage /For=ForVolumeSpec [/On=OnVolumeSpec] [/Quiet] — удаление соответствия хранилища теневых копий между томом ForVolumeSpecи томом хранилища OnVolumeSpec.  Если не указан параметр /On, будут удаленывсе соответствия хранилищ теневых копий для тома ForVolumeSpec.

Примериспользования: vssadmin Delete ShadowStorage /For=C: /On=D:

LISTPROVIDERS — список зарегистрированных поставщиков теневых копий томов.

LISTSHADOWS — список существующих теневых копий тома.

ListShadows [/For=ForVolumeSpec] [/Shadow=ShadowId|/Set=ShadowSetId] — отображение существующих теневых копий в системе.  Без параметров командаотображает все теневые копии, упорядоченные по набору теневая копий.

При создании списка допускается использование комбинаций параметров. ID теневой копии можно получить с помощью команды List Shadows. Вводить ID теневой копии необходимо в следующем формате: {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}, где X представляет шестнадцатеричные знаки.

Пример использования:  vssadmin List Shadows /Shadow={c5946237-af12-3f23-af80-51aadb3b20d5}

LISTSHADOWSTORAGE — список соответствия для хранилищ теневых копий томов.

ListShadowStorage [/For=ForVolumeSpec|/On=OnVolumeSpec] — отображение всех соответствий хранилищ теневых копий в системе. Чтобы получить полный список соответствий для указанного тома, следует указать параметр ForVolumeSpec без параметра /On.  Для перечисления всех соответствий на томе, следует указать OnVolumeSpec без параметра /For.

Примериспользования: vssadmin List ShadowStorage /On=C:

LISTVOLUMES — список томов, подходящих для создания теневых копий.

LISTWRITERS — список устройств записи теневых копий томов с имеющейся подпиской.

RESIZESHADOWSTORAGE — изменение размеров для соответствующих хранилищ теневых копий томов.

ResizeShadowStorage /For=ForVolumeSpec /On=OnVolumeSpec /MaxSize=MaxSizeSpec — изменение размеров сопоставления хранилища теневой копии тома между ForVolumeSpec и OnVolumeSpec. Изменение размеров хранилища может привести к исчезновению теневых копий.  По мере удаления теневых копий размер хранилища будет уменьшаться. Если для параметра MaxSizeSpec установлено значение UNBOUNDED, размер хранилища теневых копий не ограничивается. Параметр MaxSizeSpec может задаваться в байтах или в процентном отношении к размеру тома хранилища ForVolumeSpec.  Если параметр MaxSizeSpec задан в байтах, его значение должно быть не меньше 320MB; допускается использование следующих суффиксов: KB, MB, GB, TB, PB и EB.  Также допускаются суффиксы B, K, M, G, T, P и E.  Чтобы задать значение параметра MaxSizeSpec в процентах, используйте знак % в качестве суффикса числового значения.  Если суффикс не задан, значение MaxSizeSpec задается в байтах.

Примеры использования:

  • vssadmin Resize ShadowStorage /For=C: /On=D: /MaxSize=900MB
  • vssadmin Resize ShadowStorage /For=C: /On=D: /MaxSize=UNBOUNDED
  • vssadmin Resize ShadowStorage /For=C: /On=C: /MaxSize=20%

REVERTSHADOW — откат тома к теневой копии.

RevertShadow /Shadow=ShadowId [/ForceDismount] [/Quiet] — Откат тома к его состоянию во время создания теневой копии. Все теневые копии этого тома, созданные после этой точки, будут удалены. Все изменения файлов и папок на этом томе, сделанные после создания этой теневой копии, будут потеряны. Отмена операции отката невозможна. После запуска операции отката она не может быть прервана или отменена. Если имеются открытые дескрипторы файлов на этом томе, операция отката завершится ошибкой, если не указан флаг ForceDismount.

Пример использования: vssadmin Revert Shadow /Shadow={c5946237-af12-3f23-af80-51aadb3b20d5} /ForceDismount

QUERYREVERTS — опрос хода выполнения операций отката.

QueryReverts [/For=VolumeName] [/All] — опрос хода выполнения операций отката. Если имя тома указано с помощью флага /For, освещается ход выполнения операции отката этого тома.  Если указан флаг /All, то освещаются все выполняемые операции отката.

Примериспользования: vssadmin Query Reverts /For=E:

УТИЛИТА DISKSHADOW

Утилита командной строки DISKSHADOW это инструмент, который предоставляет функциональные возможности, предлагаемые службой теневого копирования томов (VSS). По умолчанию в Diskshadow используется интерактивный интерпретатор команд, аналогичный DiskRAID или DiskPart.

Для запуска утилиты в командной строке запущенной от имени администратора введите следующую команду, чтобы запустить интерпретатор команд – DISKSHADOW.

LISTWRITERS — выводит список всех средств записи на компьютере.

LISTSHADOWS — выводит список всех теневых копий томов на компьютере.

LISTPROVIDERS — выводит список всех поставщиков VSS на компьютере.

SET — выводит список всех текущих параметров и всех псевдонимов сценария DiskShadow, имеющихся в параметрах переменной среды.

SETCONTEXT — устанавливает контекст теневого копирования.

SETOPTION — устанавливает параметры, относящиеся к теневому копированию и автовосстановлению.

SETVERBOSE — изменяет режим подробного вывода для сценария DiskShadow.

SETMETADATA — указывает имя CAB-файла для хранения метаданных переносимых теневых копий.

SIMULATERESTORE — моделирует операцию восстановления.

LOADMETADATA — загружает документ архивных компонентов перед импортом переносимой теневой копии или выполнением операции восстановления.

IMPORT — импортирует теневые копии на основе метаданных, указанных в предыдущей команде LOAD.

WRITERVERIFY — указывает, что операция архивации или восстановления должна завершиться с ошибкой, если не включено средство записи или компонент.

WRITEREXCLUDE — исключает средство записи или компонент из архивации или восстановления.

ADD— выводит список добавленных на данный момент псевдонимов и томов.

ADDALIAS — добавляет псевдоним.

ADDVOLUME — добавляет том к набору создания теневой копии.

ADDSHADOW — Добавляет теневую копию к набору восстановления.

CREATE— создает набор теневых копий томов.

EXEC — выполняет указанный сценарий команд оболочки.

BEGINBACKUP — начинает полную архивацию.

BEGINRESTORE — начинает восстановление.

ENDBACKUP — завершает полную архивацию.

ENDRESTORE — завершает восстановление.

EXPOSE — предоставляет теневую копию.

UNEXPOSE— не предоставляет теневую копию.

REVERT — возвращает прежнее состояние теневой копии.

RESYNC— Аппаратный откат теневой копии.

BREAK — разрушает теневую копию.

MASK— скрывает от системы импортированную аппаратную теневую копию.

DELETESHADOWS — удаляет теневые копии.

RESET — сбрасывает сценарий DiskShadow в его исходное состояние.

EXIT — выполняет выход из сценария DiskShadow.

Понравилась статья? Поделить с друзьями:
  • Windows service started and then stopped
  • Windows service pack 3 gta 4
  • Windows service pack 3 for windows xp professional
  • Windows service pack 3 download 64 bit
  • Windows service pack 1 ошибка при запуске