Skip to main content
Pure Technical Services

Reclaiming Space on a Clustered Shared Volume (CSV)

Currently viewing public documentation. Please login to access the full scope of documentation.

KP_Ext_Announcement.png

Overview

In order to perform space reclamation on the Clustered Shared Volume (CSV) a drive letter to mount point mapping is required. Sdelete can be run on CSVs using the command subst to assign a virtual drive to the CSV mount point and then run sdelete on the virtual drive to perform space reclamation. This article details all of the steps required to perform this task.  Use sdelete64 for 64bit operating systems.

Steps

Step 1 -- Find out which volume is the CSV

  1. Open up a Windows PowerShell session
  2. Run "List Volume" | diskpart
  3. Note down the CSVFS Volume path, in the example below, the path is: "C:\ClusterStorage\Volume1\"

Example

PS C:\> "List Volume" | diskpart
Microsoft DiskPart version 6.3.9600
Copyright (C) 1999-2013 Microsoft Corporation.
On computer: HYPERV-NODE1
DISKPART> 
 Volume     ### Ltr Label       Fs    Type       Size    Status    Info
 ---------- --- --- ----------- ----- ---------- ------- --------- --------
 Volume      0   E                    CD-ROM         0 B No Media 
 Volume      1      System Rese NTFS  Partition   350 MB Healthy   System 
 Volume      2   C              NTFS  Partition   238 GB Healthy   Boot 
 Volume      3      SQL2014 Sys NTFS  Partition   199 GB Healthy 
   C:\Pure Storage\SQL2014-Sys\
 Volume      4      SQL2014 Tem NTFS  Partition  2047 GB Healthy 
   C:\Pure Storage\SQL2014-Tempdb\
 Volume      5   F  CommVault L NTFS  Partition  1023 GB Healthy 
 Volume      6      CSV         CSVFS Partition    15 TB Healthy 
   C:\ClusterStorage\Volume1\
 Volume      7   D                    Removable      0 B No Media 
 Volume      8      SQL2014 Dat NTFS  Partition  5119 GB Healthy 
   C:\Pure Storage\SQL2014-Data\

DISKPART> 
PS C:\> 
 
If you have multiple Clustered Shared Volumes across a large number of Windows Server Failover Clusters the below PowerShell can be used to determine the CSVs on each of the individual clusters from one centralized PowerShell script.
 
Import-Module FailoverClusters
$Volumes = @()
$ClusterName = "<CLUSTER_NAME>"

$CSV = Get-ClusterSharedVolume -Cluster $ClusterName
ForEach ($CSV in $CSVS) {
  $CSVInfo = $CSV | Select -Property Name -ExpandProperty SharedVolumeInfo
  ForEach ( $CSVInfo in $CSVInfos ) {
    $Volumes = New-Object PSObject -Property @{
       Path = $CSVInfo.FriendlyVolumeName
    }
    $Volumes.Path
  }
}
 

Step 2 -- Find out which drive letters are currently in use on the system.

  1. List drive letters currently in use: Get-PSDrive -PSProvider FileSystem
PS B:\> Get-PSDrive -PSProvider FileSystem
Name        Used (GB)       Free (GB)    Provider   Root 
----        ---------       ---------    --------   ---- 
C               39.81          198.32    FileSystem C:\ 
D                                        FileSystem D:\ 
E                                        FileSystem E:\ 
F               27.78          996.09    FileSystem F:\ 
P                                        FileSystem P:\ 
X                                        FileSystem X:\  
  1. Use the subst command and assign a virtual drive letter to the CSV volume. In my example below, I will use drive B: and map the CSV volume to "C:\ClusterStorage\Volume1\"
S G:\> subst B: C:\ClusterStorage\Volume1
PS G:\> B:
PS B:\> ls
Directory: B:\
Mode      LastWriteTime           Length Name 
----      -------------       ---------- ---- 
d----   7/12/2015 6:15 PM                PowerShellSDK_1-0-15-0 
d----   7/12/2015 6:15 PM                PowerShellToolkit-2-8-0-430 
d----   7/12/2015 6:16 PM                PowerShellToolkit-3-0-0-0 
d----  7/20/2015 11:46 PM                PythonToolkit-1-4-0 
d----   9/28/2015 6:35 PM                SCOM 
d---- 12/30/2015 11:14 PM                vdbench-1 
d----   7/12/2015 6:04 PM                vdbench-2 
d----   7/12/2015 6:04 PM                vdbench-3 
-a---  12/18/2015 1:29 AM     2718328422 PowerShellSDK_1-0-15-0.VHDX 
                                       4 
-a---  12/18/2015 1:30 AM     1084227584 PowerShellToolkit-2-8-0-430.VHDX 
                                       0 
-a---    9/9/2015 6:36 PM     9802088448 PowerShellToolkit-3-0-0-0.VHDX 
-a---  11/23/2015 3:58 AM     1114426572 PythonToolkit-1-4-0.VHDX 
                                       8 
-a---    1/9/2013 2:26 PM         155736 sdelete.exe 
-a---  12/18/2015 2:48 AM     1007052390 vdbench-1.VHDX 
                                       4 
-a---  12/18/2015 2:48 AM     1037251379 vdbench-2.VHDX 
                                       2 
-a---  12/18/2015 2:48 AM     1090938470 vdbench-3.VHDX 
                                       4 
  1.  Run sdelete to free space on the CSV.
    1. You must have the sdelete.exe file in command path or the file sdelete.exe must exist on the current path. If you do not have the sdelete program, you will have to go download from Microsoft TechNet.
    2. Go to the virtual drive, in my example above, I have drive B: mapped to the CSV.
    3. Run .\sdelete -z -s B:  
      Note Running the above parameters will zero free space and apply to sub-directories. 
    4. Note If there are CSV deleted files or folders in the Trash Bin that is not emptied, you will need to empty the trash bin before running sdelete to reclaim the space. 
 
PS B:\> .\sdelete -z -s B:
SDelete - Secure Delete v1.61
Copyright (C) 1999-2012 Mark Russinovich
Sysinternals - www.sysinternals.com
SDelete is set for 1 pass.
Zeroing free space on B:\: 0%

 

References

Reference syntax for “subst”

PS C:\Users\Administrator.CSGLAB> subst /?
Associates a path with a drive letter.

 SUBST [drive1: [drive2:]path]
 SUBST drive1: /D
    drive1:        Specifies a virtual drive to which you want to assign a path.
   [drive2:]path  Specifies a physical drive and path you want to assign to
                  a virtual drive.
   /D             Deletes a substituted (virtual) drive.
 
  Type SUBST with no parameters to display a list of current virtual drives.

 

Reference syntax for “sdelete”

PS B:\> .\sdelete.exe /h
 SDelete - Secure Delete v1.61
Copyright (C) 1999-2012 Mark Russinovich
Sysinternals - www.sysinternals.com

 usage: B:\sdelete.exe [-p passes] [-s] [-q] <file or directory> ...
       B:\sdelete.exe [-p passes] [-z|-c] [drive letter] ...
   -a         Remove Read-Only attribute
   -c         Clean free space
   -p passes  Specifies number of overwrite passes (default is 1)
   -q         Don't print errors (Quiet)
   -s or -r   Recurse subdirectories
   -z         Zero free space (good for virtual disk optimization)