If I Delete a Virtual Machine Do I Get the Storage Space Back?

In our previous article (read it here) we went through multiple ways we could deliver a highly available and cost effective virtualisation and storage solution. We decided on implementing a 4 node Hyper-Converged solution using Storage Spaces Direct in Server 2016.

Networking

Before we can set up our Storage Spaces Direct Cluster, we need to ensure our network configuration is correct. Our 4 nodes will have to have two networks. One network will only be for host failover in our failover cluster, and the other will only be used to access the hosts and guest virtual machines. We will not be using a switch for our failover network, each host will be directly connected via a 40Gb fibre connection.

On our failover network, we will be utilizing Remote Direct Memory Access (RDMA) on the Mellanox ConnectX-3 Pro adapters. RDMA is able to directly access the memory to read and write on a remote machine. The advantages of RDMA on our hosts is the ability to directly bypass any CPU involvement and bypassing the TCP/IP network stack, thus increasing performance.

To verify RDMA is enabled our on failover nics, you can run the following powershell command:

Get-NetAdapterRDMA

Configuring Storage Spaces Direct

Creating the cluster

After installing both the Hyper V role and Failover clustering feature within Server 2016, we can now create our Cluster.

Before creating the cluster, it's wise to run the cluster validation tool to ensure the hardware selected and IP addressing schemes are compatible for a clustered environment.

To run a cluster validation, use the following powershell command:

Test-Cluster –Node <MachineName1, MachineName2, MachineName3, MachineName4> –Include "Storage Spaces Direct", "Inventory", "Network", "System Configuration"

Once the validation tests are successful, we are now ready to create our cluster!

To create a cluster in Server 2016, we will use the following powershell command.

New-Cluster –Name <ClusterName> –Node <MachineName1,MachineName2,MachineName3,MachineName4> –NoStorage

It's important to include the -NoStorage parameter as we do not want the cluster to automatically add all available disks, we will configure this later.

Cluster Witness

With 4 nodes in our cluster, we want to be able to withstand the worst case scenario if our machines do go offline. By configuring a cluster witness, we will be able to withstand two nodes being completely offline without any services being impacted.

The cluster witness will act as a quorum vote in the event the cluster nodes lose connection with each other, and only one set of nodes will be active, thus preventing a split-brain situation.

For our deployment, we will be using a File share witness which is a separate backup server outside of our clustered environment.

To set a cluster file share witness, use the following powershell command:

Set-ClusterQuorum -FileShareWitness <File Share Witness Path>

Preparing disks for Storage Spaces Direct

Before we configure Storage Spaces Direct, we need to ensure the disks we are using are free of all partitions, otherwise they will not be included in the Storage Spaces Direct pool. As I have been testing and using these 4 nodes in pre-deployment, they all have stale partition data that needs to be erased. Upon re-installing Server 2016, I used the diskpart tool to clean all existing hard drives to ensure no partition data was left of any of the drives.

Enabling Storage Spaces Direct

Now that we have our 4 nodes in a cluster, all with empty unpartitioned disks we can configure Storage Spaces Direct. The powershell command we will use to enable Storage Spaces Direct in a Cluster:

Enable-ClusterStorageSpacesDirect

Once we run this command, a few things will happen. The storage system will be put into Storage Spaces Direct mode, then the following will happen:

One big storage pool will be created with the name "S2D on Cluster1" using all disks available to each host. If your storage array consists of more than one type of drive (SSD, NVMe) it will automatically assign this drive to be a read and write cache.

Two tiers will also be created, one called Capacity and one called Performance. Storage Spaces Direct will automatically configure each tier with different types of redundancy. Performance will use 3-way mirror and capacity will use Parity.

I also want to note here, that this command takes while to complete. I was stuck at "Waiting until SBL disks are surfaced" for about 30 minutes.. All the disks will disappear from Disk management/ File and Storage services and once completed be added to a storage pool.

Creating A Disk

Now that we have our storage pool, we will need to create virtual disks on top of the pool.

There are multiple ways to create a new disk/volume on our storage pool, such as within Failover Cluster Manager and also within File and Storage Services, and of course powershell.

To create a new virtual disk, open up Failover Cluster Manager, navigate to Storage > Pools, right click the newly created pool and select "New Virtual Disk"

After you have selected your storage pool, you can see the two different performance tiers. In our setup, we have a mix of HDD and SDD media types. The capacity tier (parity) is only made up of our HDD's, and our performance tier (3 way mirror) will utilize the SSD's. This is a massive over simplification of how it actually works, this article from cdemi.io has a great explanation of how it works, https://blog.cdemi.io/caching-and-storage-tiering-in-storage-spaces-direct/

Through the GUI you are forced to select a mix of Performance and Capacity tier for your virtual disk, but I only wanted to create a virtual disk on the performance tier. You can do this in powershell.

The following powershell command enabled me to create a virtual disk using 3 way mirror resiliency:

New-Volume -FriendlyName "vDisk01" -FileSystem CSVFS_ReFS -StoragePoolFriendlyName S2D* -Size 10TB -ResiliencySettingName Mirror

Once we have created a virtual disk, we want to more it highly available across all the nodes. Navigate to Storage > Disks > Add to Cluster Shared Volumes. This will then create a central storage point across all nodes at C:\ClusterStorage\Volume1.

And there you have it, you can now start deploying highly available roles (such as Hyper V virtual Machines).

If I Delete a Virtual Machine Do I Get the Storage Space Back?

Source: https://medium.com/beyond-the-helpdesk/setting-up-and-configuring-storage-spaces-direct-in-windows-server-2016-4d2be85a8f7d

0 Response to "If I Delete a Virtual Machine Do I Get the Storage Space Back?"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel