Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

How to schedule snapdrive space reclamation


Published on

How to schedule snapdrive space reclamation on windows

Published in: Technology
  • Be the first to comment

  • Be the first to like this

How to schedule snapdrive space reclamation

  1. 1. NetApp’s Snapdrive application provides ‘sdcli’ command line tool to do things that is normally done via GUI. We can use this CLI to script a ‘snapdrive space reclamation’ process. ‘Spacereclaimer’ function can be used in the script to make it run as a Windows scheduled task. SYNTAX: sdcli spacereclaimer start [-m MachineName] -d MountPoint [-t TimetoRun] -d MountPoint specifies the LUN mount point, volume name, or CSV reparse point on which you want to start Space Reclaimer. -t TimetoRun specifies the amount of time Space Reclaimer will run on the specified LUN. Specify a time from 1 to 10080 minutes (7 days). Example: LUN mount point : sdcli spacereclaimer start -d C: CSV reparse point : sdcli spacereclaimer start -d C:ClusterStorageVolume8 CSV volume name : sdcli spacereclaimer start -d ?Volume{0944ca87-be05-45ad-8606- ba13ee7388a0} The spacereclaimer analyse command checks whether space reclamation is needed for the LUN specified. SYNTAX: sdcli spacereclaimer analyze [-m MachineName] -d MountPoint sdcli spacereclaimer analyze –d C: Some background about SnapDrive Space Reclamation What Space Reclaimer does? Space Reclaimer is a SnapDrive for Windows feature that optimizes LUN space by marking newly freed space that is visible to NTFS so that it is also seen as available by Data ONTAP. Using Space Reclaimer lessens the disparity in available space that is reported by the two systems.
  2. 2. Why do you need it? When files are deleted or modified on a LUN, the space is tracked by NTFS, but since this information is not communicated to the Data ONTAP file system, a disparity can grow between the available space reported by a SnapDrive host and a storage system. Space Reclaimer ensures that newly freed blocks are marked as available on the storage system. Does it work on traditional LUN and/or vmdk? You can use Space Reclaimer on traditional LUNs and on VMDK files attached as virtual disks using NFS datastore. Important guidelines when using Space Reclaimer: • For optimum storage performance, run Space Reclaimer as often as possible and until the entire NTFS file system has been scanned. • Space reclamation is a time-consuming operation; therefore, it is best to run Space Reclaimer on your NTFS volume when there is a large amount of unused deleted space. • The space reclamation process is CPU intensive, so run Space Reclaimer when storage system and Windows host usage is low; for instance, at night. • Do not run disk defragmentation at the same time Space Reclaimer is running, as doing so can slow the disk reclamation process. • In MSCS configurations, Space Reclaimer can be initiated from the owner node only. • Although Space Reclaimer reclaims nearly all space from newly freed blocks, it does not reclaim 100 percent of the space WARNING: It is strongly recommended that the space reclamation process is performed when there is little or no activity on both the storage system and the Windows host. How often space reclamation scheduling is required? It all depends on the rate of change of data (whether modified or deleted) for the particular LUN. It is best advised to do this at the night when the host & filer are less likely to be busy. It will be waste of CPU cycles if you are going to run too often, this is b’cos “When you run Space Reclaimer on a disk that SnapDrive has determined has no space to reclaim, the space reclamation process can still take as long to complete as it would for a disk that does have reclaimable space, because SnapDrive performs NTFS block comparisons and analyses disk infrastructure regardless of whether there is space to reclaim.” Following demo shows how to schedule the space reclamation on a WEEKLY basis on a SnapDrive Created LUN on a Windows 2008 Server (Mount Point ‘D:’ in this example)
  3. 3. 1. Navigate to Start > All Programs > Administrative Tools > Task Scheduler 3. Click ‘Create a basic task...’ 4. Enter the task name and click ‘Next’. 5. On the next screen select ‘Weekly’ and click Next.
  4. 4. 6. On the next screen make it run every week on ‘Saturday’ @ 9 PM or whatever time you want to set it to run.
  5. 5. 7. On the next screen, select ‘start a program’ and click Next.
  6. 6. 8. On the next screen, 1st step, click ‘browse’ and select the ‘sdcli’ program. 2nd step, enter the argument to specify which ‘drive/mount point’ you want to run space reclamation and click Next. Just copy this into the Add Argument box: spacereclaimer start -m -d D: *Substitute –d ‘drive’ for whatever drives you want to run this on. Note: Alternatively, you can also create a ‘.BAT’ file containing the command (sdcli spacereclaimer start -m –d D:) and click ‘browse’ and select the script. In that case Add argument is not required. *Please note with ‘-m’ switch you can actually specify on which you server you want to run this task on, Bydefault it will run on a local machine.
  7. 7. 9. On the next screen, check the box ‘open the properties dialog box…’ and click ‘finish’.
  8. 8. 10. On the next screen, select the options as shown in the figure below and click OK to complete the process.
  9. 9. 11. A new task will appear in the scheduler.
  10. 10. You can also restrict the number of hours you want to run this task for, this is purely done from the Task scheduler side (I am not sure if it really works, but you can give it a try). Alternatively, you can also specify this from SDCLI spacereclaimer, using ‘-t’ switch.
  11. 11. In order to ‘TEST’ the theory, create and trigger a test schedule and check the status from sdcli prompt. If you see Percentage Completed message, that means the process is underway and the AUTO- TRIGGER is SUCCESSFUL. Reasons for SnapDrive to automatically stop Space Reclaimer: SnapDrive for Windows can automatically stops Space Reclaimer in several instances such as : • During any LUN management operation on a LUN running Space Reclaimer, including LUN disconnect and LUN delete operations • During any Snapshot copy management operation except Snapshot copy rename and delete • On all LUNs of the same storage system volume during Snapshot copy creation • If the SnapDrive service is stopped • During LUN restore operations for any volume mount points directly or indirectly mounted (cascading) from the disk being restored • During Windows host cluster failover If a host cluster failover operation occurs on a Windows Server 2003 MSCS or Windows Server 2008 failover cluster while Space Reclaimer is running on a shared LUN, space reclamation will stop running on that LUN. • During any MPIO path management operations, including adding or removing an initiator or Active path selection. Courtesy: NetApp Snapdrive Installation Guide. -Prepared by,