

# Protecting your data with shadow copies
Protecting data with shadow copies

A Microsoft Windows *shadow copy* is a snapshot of a Windows file system at a point in time. With shadow copies enabled, users can quickly recover deleted or changed files that are stored on the network, and compare file versions. Storage administrators can easily schedule shadow copies to be taken periodically using Windows PowerShell commands.

Shadow copies are stored alongside your ﬁle system's data, and consume ﬁle system storage capacity only for the changed portions of ﬁles. All shadow copies stored in your ﬁle system are included in ﬁle system backups.

**Note**  
Shadow copies are *not* enabled on FSx for Windows File Server by default. To protect the data on your file system using shadow copies, you must enable shadow copies and set up a shadow copy schedule on your file system. For more information, see [Configuring shadow copies to use the default storage and schedule](setting-up-fsx-shadow-copies.md).

**Warning**  
Shadow copies are not a substitute for backups. If you enable shadow copies, make sure that you continue performing regular backups.

**Topics**
+ [

## Best practices when using shadow copies
](#shadow-copies-best-practices)
+ [

## Setting up shadow copies
](#shadow-cpy-config-ovrvw)
+ [

# Configuring shadow copies to use the default storage and schedule
](setting-up-fsx-shadow-copies.md)
+ [

# Setting the maximum amount of shadow copy storage
](shadow-copy-storage.md)
+ [

# Viewing shadow copy storage
](get-fsxshadowstorage.md)
+ [

# Creating a custom shadow copy schedule
](shadow-schedules.md)
+ [

# Viewing the shadow copy schedule
](get-fsxshadowcopy-sched.md)
+ [

# Creating a shadow copy
](new-fsxshadow-copy.md)
+ [

# Viewing existing shadow copies
](get-fsxshadow-copies.md)
+ [

# Deleting shadow copies
](remove-fsxshadow-copies.md)
+ [

# Deleting a shadow copy schedule
](remove-fsxshadowcopy-sched.md)
+ [

# Deleting shadow copy storage, schedule, and all shadow copies
](remove-fsxshadowstorage.md)
+ [

# Troubleshooting shadow copies
](shadow-copy-ts.md)

## Best practices when using shadow copies
Best practices

You can enable shadow copies for your file system to allow end-users to view and restore individual files or folders from an earlier snapshot in Windows File Explorer. Amazon FSx uses the shadow copies feature as provided by Microsoft Windows Server. Use these best practices for shadow copies: 
+  **Ensure your file system has sufficient performance resources**: Microsoft Windows uses a copy-on-write method to record changes since the most recent shadow copy point, and this copy-on-write activity can result in up to three I/O operations for every file write operation.
+  **Use SSD storage and increase throughput capacity**: Because Windows requires a high level of I/O performance to maintain shadow copies, we recommend using SSD storage and increasing throughput capacity up to a value as high as three times that of your expected workload. This helps to ensure that your file system has enough resources to avoid issues like the unwanted deletion of shadow copies.
+  **Maintain only the number of shadow copies that you need**: If you have a large number of shadow copies—for example, more than 64 of the most recent shadow copies—or shadow copies that occupy a large amount of storage (TB-scale) on a single file system, processes such as failover and failback might take some extra time. This is due to the need for FSx for Windows to run consistency checks on the shadow copy storage. You might also experience higher latency of I/O operations due to the need for FSx for Windows to perform copy-on-write activity while maintaining the shadow copies. To minimize availability and performance impact from shadow copies, delete unused shadow copies manually or configure scripts to delete old shadow copies on your file system automatically.

**Note**  
 During [failover events](high-availability-multiAZ.md#MultiAZ-Failover) for Multi-AZ file systems, FSx for Windows runs a consistency check that requires scanning the shadow copy storage on your file system before the new active file server comes online. The duration of the consistency check is related to the number of shadow copies on your file system as well as the storage consumed. To prevent delayed failover and failback events, we recommend maintaining fewer than 64 shadow copies on your file system and following the steps below to regularly monitor and delete your oldest shadow copies. 

## Setting up shadow copies


You enable and schedule periodic shadow copies on your file system using Windows PowerShell commands defined by Amazon FSx. The following are three main settings when configuring shadow copies on your FSx for Windows File Server file system:
+ Setting the maximum amount of storage that shadow copies can consume on your file system
+ (Optional) Setting the maximum number of shadow copies that can be stored on your file system. The default value is 20.
+ (Optional) Setting a schedule that defines the times and intervals at which to take shadow copies, such as daily, weekly, and monthly

You can store a maximum of 500 shadow copies per file system at any point in time; however, we recommend maintaining fewer than 64 shadow copies at any time to ensure availability and performance. When you reach this limit, the next shadow copy that you take replaces the oldest shadow copy. Similarly, when the maximum shadow copy storage amount is reached, one or more of the oldest shadow copies are deleted to make sufficient storage space for the next shadow copy.

For information about how to quickly enable and schedule periodic shadow copies by using default Amazon FSx settings, see [Configuring shadow copies to use the default storage and schedule](setting-up-fsx-shadow-copies.md).

### Considerations for allocating shadow copy storage


A shadow copy is a block-level copy of file changes that were made since the last shadow copy. The entire file is not copied, only the changes. Therefore, previous versions of files typically don't take up as much storage space as the current file. The amount of volume space used for changes can vary according to your workload. When a file is modified, the storage space used by shadow copies depends on your workload. When you determine how much storage space to allocate for shadow copies, you should account for your workload's file system usage patterns.

When you enable shadow copies, you can specify the maximum amount of storage that shadow copies can consume on the file system. The default limit is 10 percent of your file system. We recommend that you increase the limit if your users frequently add or modify files. Setting the limit too small can result in the oldest shadow copies being deleted more often than users might expect.

You can set the shadow copy storage as unbounded (`Set-FsxShadowStorage -Maxsize "UNBOUNDED"`). However, an unbounded configuration can result in a large number of shadow copies consuming your file system storage. This could result in not having enough storage capacity for your workloads. If you set an unbounded storage, be sure to scale your storage capacity as the shadow copy limits are reached. For information about configuring your shadow copy storage to a specific size or as unbounded, see [Setting the maximum amount of shadow copy storage](shadow-copy-storage.md).

After you enable shadow copies, you can monitor the amount of storage space consumed by the shadow copies. For more information, see [Viewing shadow copy storage](get-fsxshadowstorage.md).

### Considerations when setting the maximum number of shadow copies


 When you enable shadow copies, you can specify the maximum number of shadow copies stored on the file system. The default limit is 20, and to minimize availability and performance impact from shadow copies, Microsoft recommends configuring the maximum number of shadow copies to less than 64. Because Windows requires a high level of I/O performance to maintain shadow copies, we recommend using SSD storage and increasing throughput capacity up to a value as high as three times that of your expected workload. This helps to ensure that your file system has enough resources to avoid issues like the unwanted deletion of shadow copies. 

 You can set the maximum number of shadow copies up to 500. However, if you have a large number of shadow copies or shadow copies that occupy a large amount of storage (TB-scale) on a single file system, processes such as failover and failback may take longer than expected. This is because Windows needs to run consistency checks on the shadow copy storage. You may also experience higher latency of I/O operations due to the need for Windows to perform copy-on-write activity while maintaining the shadow copies. 

### File system recommendations for shadow copies


Following are file system recommendations for using shadow copies.
+ Make sure you provision sufficient performance capacity for your workload needs on your file system. Amazon FSx delivers the Shadow Copies feature as provided by Microsoft Windows Server. By design, Microsoft Windows uses a copy-on-write method for recording the changes since the most recent shadow copy point, and this copy-on-write activity can result in up to three I/O operations for every file write operation. If Windows is unable to keep up with the incoming rate of I/O operations per second, it can cause all shadow copies to be deleted because it can no longer maintain the shadow copies via copy-on-write. Therefore, it is important that you provision sufficient I/O performance capacity for your workload needs on your file system (both the throughput capacity dimension that determines the file server I/O performance, and the storage type and capacity that determine the storage I/O performance).
+ We generally recommend that you use file systems configured with SSD storage rather than HDD storage when you enable shadow copies, given that Windows consumes a higher I/O performance to maintain shadow copies, and given that HDD storage provides lower performance capacity for I/O operations.
+ Your file system should have at least 320 MB of free space, in addition to the maximum shadow copy storage amount configured (`MaxSpace`). For example, if you allocated 5 GB `MaxSpace` to shadow copies, your file system should always have at least 320 MB free space in addition to the 5 GB `MaxSpace`.

**Warning**  
When configuring your shadow copy schedule, make sure that you don't schedule shadow copies when migrating data or when data deduplication jobs are scheduled to run. You should schedule shadow copies when you expect your file system to be idle. For information about configuring a custom shadow copy schedule, see [Creating a custom shadow copy schedule](shadow-schedules.md).

### Restoring individual files and folders


After you configure shadow copies on your Amazon FSx file system, your users can quickly restore previous versions of individual files or folders, and recover deleted files.

Users restore files to previous versions using the familiar Windows File Explorer interface. To restore a file, you choose the file to restore, then choose **Restore previous versions** from the context (right-click) menu.

![\[Restore previous versions in Windows File Explore\]](http://docs.aws.amazon.com/fsx/latest/WindowsGuide/images/restore-prev-vers.png)


 Users can then view and restore a previous version from the **Previous Versions** list. 

![\[Restore previous versions in Windows File Explorer\]](http://docs.aws.amazon.com/fsx/latest/WindowsGuide/images/rest-list.png)


# Configuring shadow copies to use the default storage and schedule
Configure shadow copies to use default settings

You can quickly set up shadow copies on your file system by using the default shadow copy storage setting and schedule. The default shadow copy storage setting lets shadow copies consume a maximum of 10 percent of your file system storage capacity. If you increase your file system's storage capacity, the amount of the currently allocated shadow copy storage is not similarly increased.

The default schedule automatically takes shadow copies every Monday, Tuesday, Wednesday, Thursday, and Friday, at 7:00 AM and 12:00 PM UTC.

**To set the default level of shadow copy storage**

1. Connect to a Windows compute instance that has network connectivity with your file system. 

1. Log in to the Windows compute instance as a member of the file system administrators group. In AWS Managed Microsoft AD, that group is **AWS Delegated FSx Administrators**. In your self-managed Microsoft AD, that group is **Domain Admins** or the custom group that you specified for administration when you created your file system. For more information, see [Connecting to Your Windows Instance](https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/connecting_to_windows_instance.html) in the *Amazon EC2 User Guide*. 

1.  Set the default amount of shadow storage using the following command. Replace `FSxFileSystem-Remote-PowerShell-Endpoint` with the Windows Remote PowerShell endpoint of file system that you want to administer. You can find the Windows Remote PowerShell endpoint in the Amazon FSx console, in the **Network & Security** section of the file system details screen, or in the response of the `DescribeFileSystem` API operation. 

   ```
   PS C:\Users\delegateadmin> Invoke-Command -ComputerName FSxFileSystem-Remote-PowerShell-Endpoint -ConfigurationName FSxRemoteAdmin -scriptblock {Set-FsxShadowStorage -Default}
   ```

   The response looks like the following.

   ```
   FSx Shadow Storage Configuration 
   
   AllocatedSpace UsedSpace    MaxSpace MaxShadowCopyNumber
   -------------- ---------    -------- -------------------
                0         0 10737418240                  20
   ```

**To set the default shadow copy schedule**

1. Connect to a Windows compute instance that has network connectivity with your file system.

1. Log in to the Windows compute instance as a member of the file system administrators group. In AWS Managed Microsoft AD, that group is **AWS Delegated FSx Administrators**. In your self-managed Microsoft AD, that group is **Domain Admins** or the custom group that you specified for administration when you created your file system. For more information, see [Connecting to Your Windows Instance](https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/connecting_to_windows_instance.html) in the *Amazon EC2 User Guide*. 

1.  Set the default shadow copy schedule by using the following command. 

   ```
   PS C:\Users\delegateadmin> Invoke-Command -ComputerName FSxFileSystem-Remote-PowerShell-Endpoint -ConfigurationName FSxRemoteAdmin -scriptblock {Set-FsxShadowCopySchedule -Default}
   ```

    The response displays the default schedule that is now set. 

   ```
   FSx Shadow Copy Schedule
   
   Start Time                Days of week                             WeeksInterval
   ----------                ------------                             -------------
   2019-07-16T07:00:00+00:00 Monday,Tuesday,Wednesday,Thursday,Friday             1
   2019-07-16T12:00:00+00:00 Monday,Tuesday,Wednesday,Thursday,Friday             1
   ```

 To learn about additional options and creating a custom shadow copy schedule, see [Creating a custom shadow copy schedule](shadow-schedules.md). 

# Setting the maximum amount of shadow copy storage


You define the maximum amount of storage that shadow copies can consume on a file system using the `Set-FsxShadowStorage` custom PowerShell command. You can specify the maximum size that shadow copies can grow to by using either the `-Maxsize` or the `-Default` parameters. Using `Default` sets the maximum to 10% of the file system's storage capacity. You cannot specify the `-Maxsize` and `-Default` parameters in the same command.

Using `-Maxsize`, you can define shadow copy storage as follows: 
+ In bytes: `Set-FsxShadowStorage -Maxsize 2500000000` 
+ In kilobytes, megabytes, gigabytes, or other units: `Set-FsxShadowStorage -Maxsize (2500MB)` or `Set-FsxShadowStorage -Maxsize (2.5GB)` 
+ As a percentage of the overall storage: `Set-FsxShadowStorage -Maxsize "20%"` 
+ As unbounded: `Set-FsxShadowStorage -Maxsize "UNBOUNDED"` 

 Use `-Default` to set shadow storage to use up to 10 percent of the file system: `Set-FsxShadowStorage -Default`. To learn more about using the default option, see [Configuring shadow copies to use the default storage and schedule](setting-up-fsx-shadow-copies.md).

**To set the amount of shadow copy storage on an FSx for Windows File Server file system**

1. Connect to a compute instance that has network connectivity with your file system as a user that is a member of the file system administrators group. In AWS Managed Microsoft AD, that group is **AWS Delegated FSx Administrators**. In your self-managed Microsoft AD, that group is **Domain Admins** or the custom group that you specified for administration when you created your file system. For more information, see [Connecting to Your Windows Instance](https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/connecting_to_windows_instance.html) in the *Amazon EC2 User Guide*. 

1.  Open a Windows PowerShell window on the compute instance. 

1.  Use the following command to open a remote PowerShell session on your Amazon FSx file system. Replace `FSxFileSystem-Remote-PowerShell-Endpoint` with the Windows Remote PowerShell endpoint of file system that you want to administer. You can find the Windows Remote PowerShell endpoint in the Amazon FSx console, in the **Network & Security** section of the file system details screen, or in the response of the `DescribeFileSystem` API operation. 

   ```
   PS C:\Users\delegateadmin> enter-pssession -computername FSxFileSystem-Remote-PowerShell-Endpoint -configurationname fsxremoteadmin
   ```

1. Verify that shadow copy storage is not already configured on the file system using the following command.

   ```
   [fs-1234567890abcef12]: PS>Get-FsxShadowStorage
   No Fsx Shadow Storage Configured
   ```

1.  Set the amount of shadow storage to 10 percent of the volume and the maximum number of shadow copes to 20 using the `-Default` option.

   ```
   [fs-1234567890abcef12]: PS>Set-FsxShadowStorage -Default
   FSx Shadow Storage Configuration
   
   AllocatedSpace UsedSpace    MaxSpace MaxShadowCopyNumber
   -------------- ---------    -------- -------------------
                0         0 32530536858                  20
   ```

You can limit the maximum number of shadow copies allowed on your file system by using the `Set-FSxShadowStorage` command with the `-MaxShadowCopyNumber` parameter and specifying a value from 1-500. By default, the maximum number of shadow copies is set to 20, as recommended for by Microsoft for active workloads.

# Viewing shadow copy storage


 You can view the amount of storage currently consumed by shadow copies on your file system using the `Get-FsxShadowStorage` command in a remote PowerShell session on your file system. For instructions on launching a remote PowerShell session on your file system, see [Using the Amazon FSx CLI for PowerShell](administering-file-systems.md#remote-pwrshell). 

```
[fs-1234567890abcef12]: PS>PS>Get-fsxshadowstorage
FSx Shadow Storage Configuration

AllocatedSpace UsedSpace    MaxSpace MaxShadowCopyNumber
-------------- ---------    -------- -------------------
             0         0 10737418240                  20
```

 The output shows the shadow storage configuration, as follows: 
+  `AllocatedSpace` – The amount of storage on the file system in bytes currently allocated to shadow copies. Initially, this value is 0. 
+  `UsedSpace` – The amount of storage, in bytes, currently used by shadow copies. Initially, this value is 0. 
+  `MaxSpace` – The maximum amount of storage, in bytes, to which shadow storage can grow. This is the value that you set for [shadow copy storage](shadow-copy-storage.md) using the `Set-FsxShadowStorage` command.
+  `MaxShadowCopyNumber` – The maximum number of shadow copies that the file system can have, from 1-500.

When the `UsedSpace` amount reaches the maximum shadow copy storage amount configured (`MaxSpace`) or the number of shadow copies reaches the maximum shadow copy number configured (`MaxShadowCopyNumber`), the next shadow copy that you take replaces the oldest shadow copy. If you don't want to lose your oldest shadow copies, monitor your shadow copy storage to make sure that you have sufficient storage space for new shadow copies. If you need more space, you can [delete existing shadow copies](remove-fsxshadow-copies.md) or increase the maximum amount of [shadow copy storage](shadow-copy-storage.md).

**Note**  
When shadow copies are automatically or manually created, they use the amount of shadow copy storage that you configured as a storage limit. Shadow copies grow in size over time and utilize the available storage space shown by the CloudWatch `FreeStorageCapacity` metric up to the maximum shadow copy storage amount configured (`MaxSpace`).

# Creating a custom shadow copy schedule


Shadow copy schedules use scheduled task triggers in Microsoft Windows to specify when shadow copies are automatically taken. A shadow copy schedule can have multiple triggers, providing you with a lot of scheduling flexibility. Only one shadow copy schedule can exist at a time. Before you can create a shadow copy schedule, you must first set the amount of [shadow copy storage](shadow-copy-storage.md).

When you run the `Set-FsxShadowCopySchedule` command on a file system, you overwrite any existing shadow copy schedule. If your client computer is in the UTC time zone, you can also specify the time zone for a trigger using Windows time zones and the `-TimezoneId` option. For a list of Windows time zones, see Microsoft's [Default Timezone](https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/default-time-zones) documentation or run the following at a Windows command prompt: `tzutil /l`. To learn more about Windows task triggers, see [Task Triggers](https://docs.microsoft.com/en-us/windows/win32/taskschd/task-triggers) in Microsoft Windows Developer Center documentation. 

You can also use the `-Default` option to quickly set up a default shadow copy schedule. To learn more, see [Configuring shadow copies to use the default storage and schedule](setting-up-fsx-shadow-copies.md). 

**To create a custom shadow copy schedule**

1. Create a set of Windows scheduled task triggers to define when shadow copies are taken in the shadow copy schedule. Use the `new-scheduledTaskTrigger` command in a PowerShell on your local machine to set multiple triggers. 

   This following example creates a custom shadow copy schedule that takes shadow copies every Monday–Friday, at 6:00 AM and at 6:00 PM UTC. By default, times are in UTC, unless you specify a time zone in the Windows scheduled task triggers you create. 

   ```
   PS C:\Users\delegateadmin> $trigger1 = new-scheduledTaskTrigger -weekly -DaysOfWeek Monday,Tuesday,Wednesday,Thursday,Friday -at 06:00
   PS C:\Users\delegateadmin> $trigger2 = new-scheduledTaskTrigger -weekly -DaysOfWeek Monday,Tuesday,Wednesday,Thursday,Friday -at 18:00
   ```

1.  Use `invoke-command` to run the `scriptblock` command. Doing so writes a script that sets the shadow copy schedule with the `new-scheduledTaskTrigger` value that you just created. Replace *`FSxFileSystem-Remote-PowerShell-Endpoint`* with the Windows Remote PowerShell endpoint of file system that you want to administer. You can find the Windows Remote PowerShell endpoint in the Amazon FSx console, in the **Network & Security** section of the file system details screen, or in the response of the `DescribeFileSystem` API operation.

   ```
   PS C:\Users\delegateadmin> invoke-command -ComputerName FSxFileSystem-Remote-PowerShell-Endpoint -ConfigurationName FSxRemoteAdmin -scriptblock {
   ```

1.  Enter the following line at the `>>` prompt to set your shadow copy schedule using the `set-fsxshadowcopyschedule` command.

   ```
   >> set-fsxshadowcopyschedule -scheduledtasktriggers $Using:trigger1,$Using:trigger2 -Confirm:$false }
   ```

    The response displays the shadow copy schedule that you configured on the file system. 

   ```
   FSx Shadow Copy Schedule
        
   
   Start Time:    : 2019-07-16T06:00:00+00:00
   Days of Week   : Monday,Tuesday,Wednesday,Thursday,Friday
   WeeksInterval  : 1
   PSComputerName : fs-0123456789abcdef1
   RunspaceId     : 12345678-90ab-cdef-1234-567890abcde1
   
   Start Time:    : 2019-07-16T18:00:00+00:00
   Days of Week   : Monday,Tuesday,Wednesday,Thursday,Friday
   WeeksInterval  : 1
   PSComputerName : fs-0123456789abcdef1
   RunspaceId     : 12345678-90ab-cdef-1234-567890abcdef
   ```

# Viewing the shadow copy schedule


To view the existing shadow copy schedule on your file system, enter the following command in a remote PowerShell session on your file system. For instructions on launching a remote PowerShell session on your file system, see [Using the Amazon FSx CLI for PowerShell](administering-file-systems.md#remote-pwrshell).

```
[fs-0123456789abcdef1]PS> Get-FsxShadowCopySchedule
FSx Shadow Copy Schedule

Start Time                Days of week                             WeeksInterval
----------                ------------                             -------------
2019-07-16T07:00:00+00:00 Monday,Tuesday,Wednesday,Thursday,Friday             1
2019-07-16T12:00:00+00:00 Monday,Tuesday,Wednesday,Thursday,Friday             1
```

# Creating a shadow copy


To manually create a shadow copy, enter the following command in a remote PowerShell session on your file system. For instructions on launching a remote PowerShell session on your file system, see [Using the Amazon FSx CLI for PowerShell](administering-file-systems.md#remote-pwrshell).

```
[fs-0123456789abcdef1]PS>New-FsxShadowCopy

Shadow Copy {ABCDEF12-3456-7890-ABCD-EF1234567890} taken successfully
```

# Viewing existing shadow copies


To view the set of existing shadow copies on your file system, enter the following command in a remote PowerShell session on your file system. For instructions on launching a remote PowerShell session on your file system, see [Using the Amazon FSx CLI for PowerShell](administering-file-systems.md#remote-pwrshell). 

```
[fs-0123456789abcdef1]PS>Get-FsxShadowCopies
FSx Shadow Copies: 2 total 

Shadow Copy ID                        Creation Time
--------------                        -----------------
{ABCDEF12-3456-7890-ABCD-EF1234567890} 6/17/2019 7:11:09 AM
{FEDCBA21-6543-0987-0987-EF3214567892} 6/19/2019 11:24:19 AM
```

# Deleting shadow copies


 You can delete one or more existing shadow copies on your file system using the `Remove-FsxShadowCopies` command in a remote PowerShell session on your file system. For instructions on launching a remote PowerShell session on your file system, see [Using the Amazon FSx CLI for PowerShell](administering-file-systems.md#remote-pwrshell).

Specify which shadow copies to delete by using one of the following required options: 
+  `-Oldest` deletes the oldest shadow copy 
+  `-All` deletes all existing shadow copies 
+  `-ShadowCopyId` deletes a specific shadow copy by ID. 

 You can use only one option with the command. An error occurs if you don't specify which shadow copy to delete, if you specify multiple shadow copy IDs, or if you specify an invalid shadow copy ID. 

To delete the oldest shadow copy on your file system, enter the following command in a remote PowerShell session on your file system.

```
[fs-0123456789abcdef1]PS>Remove-FsxShadowCopies -Oldest
Confirm
Are you sure you want to perform this action?
Performing the operation "Remove-FSxShadowCopies" on target "Removing oldest shadow copy".
[Y] Yes [A] Yes to All [N] No [L] No to All [?] Help (Default is "Y": Y
Shadow Copy {ABCDEF12-3456-7890-ABCD-EF1234567890} deleted
```

 To delete a specific shadow copy on your file system, enter the following command in a remote PowerShell session on your file system. 

```
[fs-0123456789abcdef1]PS>Remove-FsxShadowCopies -ShadowCopyId "{ABCDEF12-3456-7890-ABCD-EF1234567890}"
Are you sure you want to perform this action?
Performing the operation "Remove-FSxShadowCopies" on target "Removing shadow copy {ABCDEF12-3456-7890-ABCD-EF1234567890}".
[Y] Yes [A] Yes to All [N] No [L] No to All [?] Help (Default is "Y":>Y
Shadow Copy \\AMZNFSXABCDE123\root\cimv2:Wind32_ShadowCopy.ID{ABCDEF12-3456-7890-ABCD-EF1234567890}".ID deleted.
```

To delete a certain number of the oldest shadow copies on your file system, update your `-MaxShadowCopyNumber` parameter to the desired number of shadow copies that you would like to have remaining. However, this change will only take effect after the next shadow copy snapshot is taken, when the system will automatically delete the excess shadow copies. Use the following command in a remote PowerShell session on your file system.

```
[fs-1234567890abcef12]: PS>Get-fsxshadowstorage 
FSx Shadow Storage Configuration 

AllocatedSpace UsedSpace MaxSpace    MaxShadowCopyNumber 
-------------- --------- ----------- ------------------- 
     556679168  21659648 10737418240                  50

[fs-1234567890abcef12]: PS>Set-FsxShadowStorage  -MaxShadowCopyNumber 5
Validation
You have 50 shadow copies. Older versions of shadow copies will be deleted, keeping 5 latest shadow copies on your file system.
Do you want to continue?
[Y] Yes  [N] No  [?] Help (default is "N"): y
FSx Shadow Storage Configuration

AllocatedSpace UsedSpace    MaxSpace MaxShadowCopyNumber
-------------- ---------    -------- -------------------
     556679168  21659648 10737418240                   5
```

# Deleting a shadow copy schedule


To delete the existing shadow copy schedule on your file system, enter the following command in a remote PowerShell session on your file system. For instructions on launching a remote PowerShell session on your file system, see [Using the Amazon FSx CLI for PowerShell](administering-file-systems.md#remote-pwrshell).

```
[fs-0123456789abcdef1]PS>Remove-FsxShadowCopySchedule
 
Confirm
Are you sure you want to perform this action?
Performing the operation "Remove-FsxShadowCopySchedule" on target "Removing FSx Shadow Copy Schedule". 
[Y] Yes [A] Yes to All [N] No [L] No to All [?] Help (Default is "Y"): Y
[fs-0123456789abcdef1]PS>
```

# Deleting shadow copy storage, schedule, and all shadow copies
Deleting a shadow copy configuration

 You can delete your shadow copy configuration, including all existing shadow copies and the shadow copy schedule. At the same time, you can release the shadow copy storage on the file system.

To do this, enter the `Remove-FsxShadowStorage` command in a remote PowerShell session on your file system. For instructions on launching a remote PowerShell session on your file system, see [Using the Amazon FSx CLI for PowerShell](administering-file-systems.md#remote-pwrshell). 

```
[fs-0123456789abcdef1]PS>Remove-FsxShadowStorage

Confirm
Are you sure you want to perform this action?
Performing the operation "Remove-FsxShadowStorage" on target "Removing all Shadow Copies, Shadow Copy Schedule, and Shadow Storage".
[Y] Yes [A] Yes to All [N] No [L] No to All [?] Help (Default is "Y": Y
FSx Shadow Storage Configuration
Removing Shadow Copy Schedule
Removing Shadow Copies
All shadow copies removed.
Removing Shadow Storage
Shadow Storage removed successfully.
```

# Troubleshooting shadow copies


There are a number of potential causes when shadow copies are missing or inaccessible, as described in the following section.

**Topics**
+ [

## Oldest shadow copies are missing
](#w2aac22c11c37b7)
+ [

## All of my shadow copies are missing
](#w2aac22c11c37b9)
+ [

## Cannot create Amazon FSx backups or access shadow copies on a recently restored or updated file system
](#w2aac22c11c37c11)

## Oldest shadow copies are missing


The oldest shadow copies are deleted in either of these situations:
+ If you have 500 shadow copies, the next shadow copy replaces the oldest shadow copy, regardless of the remaining allocated storage volume space for shadow copies.
+ If the maximum shadow copy storage amount configured is reached, the next shadow copy replaces one or more of the oldest shadow copies, even if you have fewer than 500 shadow copies.

Both results are expected behavior. If you have insufficient storage allocated for shadow copies, consider increasing the storage you have allocated.

## All of my shadow copies are missing


Having insufficient I/O performance capacity on your file system (for example, because you're using HDD storage, because the HDD storage has run out of burst capacity, or because the throughput capacity is insufficient) can cause all shadow copies to be deleted by Windows Server because it is unable to maintain the shadow copies with the available I/O performance capacity. Consider the following recommendations to help prevent this problem:
+ If you're using HDD storage, use the Amazon FSx console or Amazon FSx API to switch to using SSD storage. For more information, see [Managing your file system's storage type](managing-storage-configuration.md#managing-storage-type).
+ Increase the file system's throughput capacity to a value three times your expected workload.
+ Make sure that your file system has at least 320 MB of free space, in addition to the maximum shadow copy storage amount configured.
+ Schedule shadow copies when you expect your file system to be idle.

For more information, see [File system recommendations for shadow copies](shadow-copies-fsxW.md#shadow-cpy-config-recommend).

## Cannot create Amazon FSx backups or access shadow copies on a recently restored or updated file system


This is expected behavior. Amazon FSx rebuilds the shadow-copy state on a recently restored file system and does not allow access to shadow copies or backups while the rebuilding is still in progress.