How to move a SharePoint Search Index

How to move a SharePoint Search Index

I recently had to move a SharePoint 2013 on-premise search index from the system drive, onto its own dedicated disk.  The search index was taking up an increasing amount of space as the content size grew in the SharePoint farm, and I was fresh off repairing the Search Service after the system drive ran out of disk space.

The procedure for doing so can seem strange at first glance, but at a high level, what we’re really looking to accomplish is to create a copy of our current search “map” (or topology as it is referred to in documentation), modify that copy to point to a new index location, and replace the old search “map” with our freshly cloned “map”.  Then, of course, check and make sure everything is working, both at the farm level, and from the user perspective by doing some searching and looking at the search results.

With that in mind, let’s do this!

 

Moving a SharePoint Search Index

 

Since we’ll be moving the index component, we don’t want anything new being written into it.  Some SharePoint 2013 environments may be configured with the continuous crawl schedule, so we’ll have to disable that before performing any operations on the index.  Even for environments with the traditional incremental/full crawl schedules, make sure to check that those are not scheduled to run, and I will pause those schedules just to be on the safe side.

Now we can get into the action, using PowerShell to do all the heavy lifting.  Credit to Marco Rietveld over at http://blog.sharepointgeek.nl/post/2013/09/18/Move-the-search-index-location-in-SharePoint-2013.aspx for the excellent and concise post outlining the procedure.

 

Get the current Search topology

$ssa = Get-SPEnterpriseSearchServiceApplication “Search Service Application”
$instance=Get-SPEnterpriseSearchServiceInstance -Local
$current=Get-SPEnterpriseSearchTopology -SearchApplication $ssa

 

Clone the current Search topology

$clone=New-SPEnterpriseSearchTopology -Clone -SearchApplication $ssa -SearchTopology $current

 

Modify the cloned Search topology

We’re adding a second index component here, in the desired new location
New-SPEnterpriseSearchIndexComponent -SearchTopology $clone -IndexPartition 0 -SearchServiceInstance $instance -RootDirectory “E:\NewIndexLocation”

 

Activate the cloned Search topology

Set-SPEnterpriseSearchTopology -Identity $clone

 

Remove the old Search topology

Remove-SPEnterpriseSearchTopology -Identity $current

Before removing the old index component, it is important to make sure the new index component is ready.  This can be viewed either on the Central Admin Search Administration home page, or via the Get-SPEnterpriseSearchStatus.  We’re looking for the new index component status to read “Active”.

Initially, you may see as you refresh the Central Admin Search Administration home page that the Index Partition has a scary yellow caution sign.  If you are checking with PowerShell, your shiny new index component could have a status of degraded.  Be patient and stay the course, this is expected as SharePoint makes a copy of the index to the new location.  In this particular case, the index file was 22.2 GB, and took around five minutes to finish provisioning the new index component.

 

Remove the old index component

The commands below enable us to obtain, clone, modify, and activate the new search topology, then remove the old search topology.  Our new search “map” points SharePoint Search to the newly specified file location, on its own dedicated volume, separate from the drive on which SharePoint has been installed.

$current=Get-SPEnterpriseSearchTopology -SearchApplication $ssa
$clone=New-SPEnterpriseSearchTopology -Clone -SearchApplication $ssa -SearchTopology $current
$comp=Get-SPEnterpriseSearchComponent -SearchTopology $clone | ? {$_.Name -eq “IndexComponent1″}
Remove-SPEnterpriseSearchComponent -Identity $comp -SearchTopology $clone
Set-SPEnterpriseSearchTopology -Identity $clone
Remove-SPEnterpriseSearchTopology -Identity $current

And that’s it!  As a follow up, I’ll enable the crawl schedule, and check on the Crawl Logs after the next crawl for anything unusual.  Then, I make sure I’m getting good search results within the SharePoint sites themselves.  If everything goes as expected, it is a pretty painless operation.

About the Author

Drew is IT Director of Total Solutions and is primarily responsible for overseeing all internal infrastructure and technology. Drew also works with clients as a Senior SharePoint Consultant. Drew is a graduate of Michigan State University, and in his free time enjoys the outdoors, watching and playing various sports, and the occasional video game.

Submit a Comment