= Storage Efficiency Features
:toc:
:icons:
:linkattrs:
:imagesdir: ../resources/images

== Summary

This section will cover Storage Efficiency features that can be enabled on your *Amazon FSx for NetApp ONTAP* file system.


=== Storage Efficiency features Overview


. *Compression*: Compresses data blocks to eliminate the amount of physical storage required.
. *Deduplication*: Eliminates duplicate data blocks to achieve storage efficiency and optimize cost. You can enable Inline and post-process deduplication for your volume. 
. *Compaction*: Aggregates multiple small file IO operations and IO operations that are padded with zeros into a single 4KB block on disk. For example, if you have small file IO (<4KB) instead of allocating one 4KB block to each IO, Compaction will aggregate multiple smaller IO operations into a single 4KB block.


You can enable or disable these *Storage Efficiency* features for your *Amazon FSx for NetApp ONTAP* volumes. You can run deduplication, data compression, and data compaction together or independently to achieve optimal space savings on a volume. With all three features enabled, when new data is written to your volume:

* First, Inline data compression will compress incoming data blocks.
* Next, Inline deduplication will remove duplicate blocks.
* Next, Inline data compaction will compact smaller IO's (<4KB) that may or may not be already compressed and deduplicated into 4KB block before writing to your file system.


== Duration

NOTE: It will take approximately 05 minutes to complete this section.

== Diagram 

You will be using resources deployed in *Primary VPC* for this section of the workshop.

image::primary-architecture.png[align="center"]

== Step-by-step Guide (Storage Efficiency)

=== Storage Efficiency Features

. *_Run_* the command below to SSH to the cluster management endpoint of your *Primary* FSx for ONTAP file system.
+
TIP: If the Session Manager window has timed out, e.g. the session is unresponsive, close the  session window and create a new one. Return to the link:https://console.aws.amazon.com/ec2/[Amazon EC2] console. *_Click_* the radio button next to the instance with the name *FSx for ONTAP Workshop Linux Instance*. *_Click_* the *Connect* button. Connect using AWS Systems Manager - *_Select_* *Session Manager* tab and *_click_* the Connect button to open a session in your browser.  Change the shell back to bash by typing the command ***bash*** and then return.
+

+
[source,bash]
----
ssh ${ADMINUSER}@${MGMTENDPOINT}
----
+
. *_Run_* the below command to check if Storage Efficiency is enabled on your volume.
+
[source,bash]
----
volume efficiency show
----
+
. *_Examine_* the fields *State* and *Policy*. 

. *_Run_* the below command to check which Storage Efficiency features are enabled or disabled on your volume.
+
[source,bash]
----
volume efficiency show -vserver svm01-primary -volume vol1_primary
----
+

. *_Examine_* the following fields. 
* Efficiency Policy Name
* Inline Compression
* Inline Dedupe
* Data Compaction

+
NOTE: All volumes are assigned the *auto* efficiency policy by default when storage efficiency is enabled and use the storage efficiency mode of efficient. This default configuration performs inline deduplication, inline compression, and inline compaction. If required, you can assign a custom policy and a schedule for your post-process deduplication jobs.
+
. *_Run_* the below command to check the deduplication savings for your volume.
+
[source,bash]
----
volume show -vserver svm01-primary -volume vol1_primary -fields dedupe-space-saved,dedupe-space-saved-percent
----
+

. Do you see any deduplication savings?

+
. *_Run_* the below command to view statistics of inline compression operations on your volume.
+
[source,bash]
----
volume efficiency stat -vserver svm01-primary -volume vol1_primary
----
+

. *_Run_* the command below to quit the ONTAP CLI session.
+
[source,bash]
----
quit
----


== Next section

Click the button below to go to the next section.

image::snapmirror.png[link=../08-disaster-recovery-snapmirror/, align="left",width=420]




