- Служба теневого копирования в Windows Server
- Volume Shadow Copy Service
- How Volume Shadow Copy Service Works
- How a Shadow Copy Is Created
- How the Provider Creates a Shadow Copy
- Complete copy
- Copy-on-write method
- Redirect-on-write method
- Shadow Copy Providers
- Hardware-based providers
- Software-based providers
- System provider
- In-Box VSS Writers
- How Shadow Copies Are Used
- Restoring LUNs (LUN resynchronization and LUN swapping)
- Restoring individual files (Shadow Copies for Shared Folders)
- Data mining by using transportable shadow copies
- To transport a shadow copy
- Frequently Asked Questions
- When was Volume Shadow Copy Service introduced? On which Windows operating system versions is it available?
- What is the difference between a shadow copy and a backup?
- What is the largest size volume that Volume Shadow Copy Service supports?
- I made a backup on Windows ServerВ 2008. Can I restore it on Windows ServerВ 2008В R2?
- I made a backup on Windows ServerВ 2003. Can I restore it on Windows ServerВ 2008?
- How can I disable VSS?
- Can I exclude files from a shadow copy to save space?
- My non-Microsoft backup program failed with a VSS error. What can I do?
- What is the «diff area»?
- Where is the diff area located?
- How is the diff area location determined?
- Can VSS create shadow copies of non-NTFS volumes?
- What’s the maximum number of shadow copies I can create at one time?
- What’s the maximum number of software shadow copies created by the system provider that I can maintain for a volume?
- How can I control the space that is used for shadow copy storage space?
- What happens when I run out of space?
- Volume Shadow Copy Service Tools
- DiskShadow
- VssAdmin
- Volume Shadow Copy Service Registry Keys
- VssAccessControl
- MaxShadowCopies
- MinDiffAreaFileSize
- Supported Operating System Versions
Служба теневого копирования в Windows Server
Речь сегодня пойдет о тех ситуациях, когда большая группа коллег-аудиторов использует общие файловые ресурсы для подготовки, редактирования и хранения данных. В процессе использования общих ресурсов регулярно возникают случаи, когда тот или иной файл удаляется или редактируется. Причем это может непреднамеренно сделать как сам автор документа, так и кто-то из коллег, имеющих доступ к каталогам. И вот наступает день, когда нам срочно нужен тот самый файл…
В этот день вспомните нашу рекомендацию и попробуйте использовать инструмент от Microsoft — Volume Shadow Copy Service (VSS) — службу теневого копирования томов. Многим из нас он наверно знаком, а для остальных попытаемся кратко изложить его суть и возможности.
Представим себе, что имеем дело с файловым сервером с множеством каталогов и большим количеством пользователей, и активированной службой теневого копирования. Наш пользователь в начале рабочего дня внес важные изменения в сверхкритичный документ, расположенный в папке на сетевом ресурсе этого сервера. Затем, в течение рабочего дня случайно его модифицировал или удалил.
Тут на помощь и приходит VSS.
В чем все-таки его суть, спросите вы?
Прежде всего, это снапшот (снимок) всей информации, хранящейся на диске. После создания теневой копии VSS начинает отслеживать изменение данных на диске. Таким образом, при создании следующей теневой копии данных система не копирует данные целиком, а только лишь блочные изменения. Благодаря этому система теневого копирования позволяет существенно сэкономить место на диске сервера.
Еще несколько особенностей VSS:
- По умолчанию максимальное количество хранимых снапшотов для диска – 64. При превышении этого значения, служба VSS начинает циклическую перезапись теневых копий, удаляя самые ранние снапшоты.
- Под теневые копии система выделяет 10% емкости раздела на диске сервера, однако это значение администратор сервера можно изменить.
- Теневое копирование включается для тома целиком, и включить его для отдельной общей папки невозможно.
- Не рекомендуется создавать снапшоты чаще, чем раз в час.
Итак, если системные администраторы произвели настройки службы теневого копирования томов VSS для раздаваемых пользователям сетевых ресурсов сервера, то для этих сетевых ресурсов можно использовать возможности службы теневого копирования файлов.
Если открыть свойства общей папки на сервере с активированной службой VSS и перейти на вкладку «Предыдущие версии», то можно увидеть список доступных на данный момент теневых копий.
Далее у пользователя есть три варианта действия:
- Просмотреть содержимое копии — (Открыть).
- Открыть нужный резервный снапшот и скопировать нужный файл(ы)/папку(и) из копии в другое место — (Копировать).
- Восстановить данные с перезаписью — (Восстановить).
При попытке восстановить содержимое копии на момент снапшота будут заменены все файлы и подкаталоги на момент создания снапшота. Система покажет соответствующее предупреждение.
Основные преимущества VSS для пользователей по сравнению с классическими средствами резервного копирования данных:
- высокая скорость создания резервных копий,
- возможность самостоятельного восстановления файлов пользователями (при наличии прав на запись в каталог),
- возможность копирования используемых (заблокированных) другими пользователями файлов.
Вывод: VSS — отличное средство, позволяющее пользователям в течение дня оперативно и в удобной форме восстановить удаленный файл или откатиться к предыдущей версии документа. Нужно не забывать, что теневое копирование не отменяет необходимость выполнения классического резервного копирования данных, позволяющего восстановить данные даже в случае аппаратного сбоя.
К вышесказанному можно добавить, что активированная служба VSS это дополнительное средство для аудитора при проверке сетевых ресурсов пользователей. С его помощью можно отследить изменения информации в каталогах сервера, сделанные пользователями проверяемого подразделения в определенный период времени (в зависимости от настроек теневого копирования, произведенных администраторами сервера) и восстановить, к примеру, «случайно» удаленные сотрудником документы.
Удачи в проверках и берегите свою информацию!
Volume Shadow Copy Service
Applies to: Windows Server 2019, Windows Server 2016, Windows Server 2012 R2, Windows Server 2012, and Windows Server 2008 R2, Windows Server 2008, Windows 10, Windows 8.1, Windows 8, Windows 7
Backing up and restoring critical business data can be very complex due to the following issues:
The data usually needs to be backed up while the applications that produce the data are still running. This means that some of the data files might be open or they might be in an inconsistent state.
If the data set is large, it can be difficult to back up all of it at one time.
Correctly performing backup and restore operations requires close coordination between the backup applications, the line-of-business applications that are being backed up, and the storage management hardware and software. The Volume Shadow Copy Service (VSS), which was introduced in Windows Server® 2003, facilitates the conversation between these components to allow them to work better together. When all the components support VSS, you can use them to back up your application data without taking the applications offline.
VSS coordinates the actions that are required to create a consistent shadow copy (also known as a snapshot or a point-in-time copy) of the data that is to be backed up. The shadow copy can be used as-is, or it can be used in scenarios such as the following:
You want to back up application data and system state information, including archiving data to another hard disk drive, to tape, or to other removable media.
You are data mining.
You are performing disk-to-disk backups.
You need a fast recovery from data loss by restoring data to the original Logical Unit Number (LUN) or to an entirely new LUN that replaces an original LUN that failed.
Windows features and applications that use VSS include the following:
How Volume Shadow Copy Service Works
A complete VSS solution requires all of the following basic parts:
VSS serviceВ В В Part of the Windows operating system that ensures the other components can communicate with each other properly and work together.
VSS requesterВ В В The software that requests the actual creation of shadow copies (or other high-level operations like importing or deleting them). Typically, this is the backup application. The Windows Server Backup utility and the System Center Data Protection Manager application are VSS requesters. Non-MicrosoftВ® VSS requesters include nearly all backup software that runs on Windows.
VSS writerВ В В The component that guarantees we have a consistent data set to back up. This is typically provided as part of a line-of-business application, such as SQL ServerВ® or Exchange Server. VSS writers for various Windows components, such as the registry, are included with the Windows operating system. Non-Microsoft VSS writers are included with many applications for Windows that need to guarantee data consistency during back up.
VSS providerВ В В The component that creates and maintains the shadow copies. This can occur in the software or in the hardware. The Windows operating system includes a VSS provider that uses copy-on-write. If you use a storage area network (SAN), it is important that you install the VSS hardware provider for the SAN, if one is provided. A hardware provider offloads the task of creating and maintaining a shadow copy from the host operating system.
The following diagram illustrates how the VSS service coordinates with requesters, writers, and providers to create a shadow copy of a volume.
FigureВ 1В В В Architectural diagram of Volume Shadow Copy Service
How a Shadow Copy Is Created
This section puts the various roles of the requester, writer, and provider into context by listing the steps that need to be taken to create a shadow copy. The following diagram shows how the Volume Shadow Copy Service controls the overall coordination of the requester, writer, and provider.
FigureВ 2 Shadow copy creation process
To create a shadow copy, the requester, writer, and provider perform the following actions:
The requester asks the Volume Shadow Copy Service to enumerate the writers, gather the writer metadata, and prepare for shadow copy creation.
Each writer creates an XML description of the components and data stores that need to be backed up and provides it to the Volume Shadow Copy Service. The writer also defines a restore method, which is used for all components. The Volume Shadow Copy Service provides the writer’s description to the requester, which selects the components that will be backed up.
The Volume Shadow Copy Service notifies all the writers to prepare their data for making a shadow copy.
Each writer prepares the data as appropriate, such as completing all open transactions, rolling transaction logs, and flushing caches. When the data is ready to be shadow-copied, the writer notifies the Volume Shadow Copy Service.
The Volume Shadow Copy Service tells the writers to temporarily freeze application write I/O requests (read I/O requests are still possible) for the few seconds that are required to create the shadow copy of the volume or volumes. The application freeze is not allowed to take longer than 60 seconds. The Volume Shadow Copy Service flushes the file system buffers and then freezes the file system, which ensures that the file system metadata is recorded correctly and the data to be shadow-copied is written in a consistent order.
The Volume Shadow Copy Service tells the provider to create the shadow copy. The shadow copy creation period lasts no more than 10 seconds, during which all write I/O requests to the file system remain frozen.
The Volume Shadow Copy Service releases file system write I/O requests.
VSS tells the writers to thaw application write I/O requests. At this point applications are free to resume writing data to the disk that is being shadow-copied.
The shadow copy creation can be aborted if the writers are kept in the freeze state for longer than 60 seconds or if the providers take longer than 10 seconds to commit the shadow copy.
The requester can retry the process (go back to step 1) or notify the administrator to retry at a later time.
If the shadow copy is successfully created, the Volume Shadow Copy Service returns the location information for the shadow copy to the requester. In some cases, the shadow copy can be temporarily made available as a read-write volume so that VSS and one or more applications can alter the contents of the shadow copy before the shadow copy is finished. After VSS and the applications make their alterations, the shadow copy is made read-only. This phase is called Auto-recovery, and it is used to undo any file-system or application transactions on the shadow copy volume that were not completed before the shadow copy was created.
How the Provider Creates a Shadow Copy
A hardware or software shadow copy provider uses one of the following methods for creating a shadow copy:
Complete copyВ В В This method makes a complete copy (called a «full copy» or «clone») of the original volume at a given point in time. This copy is read-only.
Copy-on-writeВ В В This method does not copy the original volume. Instead, it makes a differential copy by copying all changes (completed write I/O requests) that are made to the volume after a given point in time.
Redirect-on-writeВ В В This method does not copy the original volume, and it does not make any changes to the original volume after a given point in time. Instead, it makes a differential copy by redirecting all changes to a different volume.
Complete copy
A complete copy is usually created by making a «split mirror» as follows:
The original volume and the shadow copy volume are a mirrored volume set.
The shadow copy volume is separated from the original volume. This breaks the mirror connection.
After the mirror connection is broken, the original volume and the shadow copy volume are independent. The original volume continues to accept all changes (write I/O requests), while the shadow copy volume remains an exact read-only copy of the original data at the time of the break.
Copy-on-write method
In the copy-on-write method, when a change to the original volume occurs (but before the write I/O request is completed), each block to be modified is read and then written to the volume’s shadow copy storage area (also called its «diff area»). The shadow copy storage area can be on the same volume or a different volume. This preserves a copy of the data block on the original volume before the change overwrites it.
Time | Source data (status and data) | Shadow copy (status and data) | |||||
---|---|---|---|---|---|---|---|
Time | Source data (status and data) | Shadow copy (status and data) | ||
---|---|---|---|---|
VSS feature | Minimum supported client | Minimum supported server |
---|---|---|
Note |
---|
This is the ability to import a shadow copy more than once. Only one import operation can be performed at a time. |
Windows ServerВ 2008
Shadow Copies for Shared Folders
Windows ServerВ 2003
Transportable auto-recovered shadow copies
Windows ServerВ 2008
Concurrent backup sessions (up to 64)
Windows ServerВ 2003
Single restore session concurrent with backups
Windows ServerВ 2003 with SP2
Up to 8 restore sessions concurrent with backups