ARTIFACTORY: How to Prevent Full-Disk Risk Using Filestore Sharding

Products
Frog_Artifactory
Content Type
Administration_Platform
AuthorFullName__c
David Pinhas, Vitaliy Novozhilov
articleNumber
000004767
FirstPublishedDate
2020-02-23T09:57:47Z
lastModifiedDate
2025-05-27

ARTIFACTORY: How to Prevent Full-Disk Risk Using Filestore Sharding

Introduction 

This article describes using Filstore Sharding with writeBehavior=freeSpace mode, which is suitable as a way to scale storage and an option when space has already run out and you are considering adding a disk.

Note:

The following info is intended for Self-Hosted deployments with an Enterprise X or Enterprise+ license. If you are a JFrog Cloud user, the features described on this page are all monitored and optimally managed for you by JFrog Cloud team.



Filestore Sharding


Filestore Sharding is the ability to distribute Artifactory binaries across multiple physical storage devices (shards) with the ability to copy them redundantly.

When adding a new disk to your production environment, you can configure the binary provider using Basic Sharding Configuration for local filesystem, which will allow you to manage your binaries on a sharded file store.

This will allow you to set writeBehavior to 'freeSpace'. Setting writeBehavior to 'freeSpace' ensures that binaries are written to the mount with the largest absolute amount of free space. Which, in our case, will fill the new disk first, as it will have more free disk space, and will balance out once the new disk's disk space reaches the same percentage of free space as the current disk.

In addition to the above, you can specify the path to both the old and new disks under your shards' provider ID by specifying 'fileStoreDir' in binarystore.xml:
<config version="2">
  <chain>
    <provider type="sharding" id="sharding">
      <sub-provider type="file-system" id="fs-shard1"/>
      <sub-provider type="file-system" id="fs-shard2"/>
      <redundancy>2</redundancy>
    </provider>
  </chain>

  <provider id="fs-shard1" type="file-system">
    <fileStoreDir>/mnt/artifactory-shard1/filestore</fileStoreDir>
  </provider>
  <provider id="fs-shard2" type="file-system">
    <fileStoreDir>/mnt/artifactory-shard2/filestore</fileStoreDir>
  </provider>
</config>

Once you have configured the Sharding binary provider, you will need to use the Optimize System Storage REST API, to trigger rebalancing between the redundant storage units of the sharded file store.

If you are running Artifactory from 4.6.0 to 7.98.x: Calling this API sets a flag that will allow rebalancing to occur during the next FullGC operation. Therefore, after calling the API, you need to trigger a full garbage collection. This is achieved by calling the appropriate API. For more information, see the corresponding article.

Since Artifactory 7.104.5, calling the optimization API immediately triggers the rebalancing process.

Important:

When setting up sharding, it is recommended to test the method in a test environment before deploying it to the production environment.



Conclusion


Using Filestore Sharding will not only help to quickly stop the situation with running out of disk space, but also increase the performance of file storage, fault tolerance and scalability. Key benefits:

- Volume growth: when one disk/volume reaches its limit, and expansion is inconvenient.
- Fault tolerance: withstands the failure of individual shards without data loss.
- Horizontal scaling: adding shards “on the fly” without downtime filestore.
- Combination with storage policies: built-in sharding complements long-term cleanup policies and cold storage, distributing the load and reducing the risk of disk-full.