Skip to content

Network Configuration Storage Optimization - Hard Links

Config Hard Link: Optimizing Configuration Storage

Section titled “Config Hard Link: Optimizing Configuration Storage”

The Config Hard Link feature reduces storage consumption for configuration backups by creating file system hard links instead of duplicate files when consecutive backups capture identical configurations. This optimization maintains complete version history while significantly reducing disk space usage for devices with stable configurations.


When rConfig backs up a device configuration, it compares the new backup against the previous version. If the configurations are identical (same content, same hash), rConfig has two storage options:

Without Hard Link (traditional approach): Store a complete duplicate file for the new backup version. If daily backups run for 30 days with no configuration changes, 30 identical files consume 30× the storage.

With Hard Link (optimized approach): Create a hard link pointing to the existing file instead of duplicating it. The file system maintains one physical copy on disk with multiple directory entries (hard links) referencing it. Storage consumption: 1× the file size regardless of backup frequency.

Hard links are file system-level references that allow multiple directory entries to point to the same physical data on disk. Unlike symbolic links (shortcuts), hard links are indistinguishable from the original file—deleting one hard link doesn’t affect others, and the physical data remains on disk until all hard links are removed.

For configuration backups, this means each backup version appears as a separate file in rConfig’s directory structure, maintains independent timestamps and metadata, and can be accessed or compared individually—all while the actual configuration data exists only once on disk.


Devices with stable configurations (edge routers, access switches with standard configs, infrastructure that rarely changes) generate identical backups daily. Without hard links, a device backing up daily for a year with minimal changes could consume 365× the configuration file size. With hard links, storage consumption approaches 1× file size plus storage for actual changes.

Example: 1000 edge switches, 50KB config each, daily backups, 90-day retention, 80% of configs unchanged daily:

  • Without hard links: ~4.5GB daily × 90 days = 405GB
  • With hard links: ~900MB for actual changes = 90% storage reduction

Hard link creation is a metadata operation, orders of magnitude faster than copying large configuration files. This reduces backup execution time, particularly for large-scale deployments with thousands of daily backups.

Hard links maintain the appearance of complete version history—every backup creates a “new file” from the user perspective. Configuration diffs, historical access, and compliance reporting work identically whether files are hard links or physical copies. Operations teams don’t need to change workflows or understand underlying storage optimization.


Hard links require file system support (ext4, XFS, NTFS, most modern file systems support hard links). Verify your rConfig server’s file system supports hard links before enabling this feature.

Edit the rConfig environment configuration file:

Terminal window
# Navigate to rConfig installation directory
cd /var/www/html/rconfig8/current
# Edit environment file
nano .env

Add or modify the HARD_LINK setting:

Terminal window
HARD_LINK=true

Save the file and restart rConfig services:

Terminal window
# Restart PHP-FPM
systemctl restart php-fpm
# Restart web server (Apache or Nginx)
systemctl restart nginx
# OR
systemctl restart httpd

After enabling, run a backup on a test device twice without making configuration changes:

  1. Navigate to device in rConfig UI
  2. Run manual backup
  3. Wait for completion
  4. Run manual backup again (configuration unchanged)
  5. Check device config history—second backup should show hard link indicator

Hard-linked configurations display a link icon (🔗) in the rConfig interface, providing immediate visual confirmation that the configuration uses storage optimization.

rConfig V8 configuration view displaying hard link indicator icon for linked device configurations

Hard link indicator (🔗) showing storage-optimized configuration version

Where the indicator appears:

  • Device configuration history view
  • Configuration comparison interfaces
  • Configuration file listings

To verify hard links at the system level:

Terminal window
# Check hard link count for a configuration file
ls -l /storage/app/rconfig/data/[category]/[device]/[year]/[month]/[day]/config_file.txt
# Output shows link count (number after permissions)
-rw-r--r-- 5 www-data www-data 51234 Oct 02 14:35 config_file.txt
^
Link count = 5 (one original + 4 hard links)

A link count greater than 1 indicates the file has hard links.


Hard link effectiveness depends on configuration change frequency:

High savings environments:

  • Stable edge infrastructure
  • Standardized access layer devices
  • Devices with infrequent configuration changes
  • Long retention periods (90+ days)

Lower savings environments:

  • Core network devices with frequent changes
  • Devices under active configuration management
  • Infrastructure with daily automated changes
  • Short retention periods (7-30 days)

Hard links are transparent to rConfig operations:

  • Configuration diffs work identically
  • Version history displays normally
  • Configuration restore functions unchanged
  • Compliance checking unaffected
  • All features operate as if files are physical copies

When backing up or migrating rConfig servers:

Standard file copy (cp, rsync without special flags): Breaks hard links, creating physical copies. This increases storage but ensures compatibility.

Hard link-aware copy (cp -a, rsync -H): Preserves hard links in the destination. Maintains storage optimization but requires hard link support on destination file system.

Choose the appropriate method based on destination file system capabilities and storage requirements.


To disable hard link creation:

  1. Edit .env file:
Terminal window
HARD_LINK=false
  1. Restart rConfig services:
Terminal window
systemctl restart php-fpm
systemctl restart nginx # or httpd

Effect: Future backups create physical file copies instead of hard links. Existing hard links remain but won’t be removed—they continue functioning normally until individual versions are purged per retention policies.


Symptom: HARD_LINK=true but new backups create physical copies instead of hard links.

Possible causes:

  1. File system doesn’t support hard links
  2. Configuration changes between backups (hashes differ)
  3. Files on different file systems/partitions
  4. Insufficient permissions

Resolution:

  • Verify file system supports hard links: df -T /storage/app/rconfig
  • Confirm configurations are actually identical (compare file hashes)
  • Ensure rConfig storage is on a single file system
  • Check www-data user has appropriate permissions

Symptom: Enabled hard links but storage usage unchanged.

Possible causes:

  1. Configurations are changing frequently (no identical backups to link)
  2. Retention already purged old duplicates before hard links enabled
  3. Monitoring tool doesn’t account for hard links correctly

Resolution:

  • Review configuration change frequency in device history
  • Allow several backup cycles for savings to accumulate
  • Use du -h --apparent-size vs du -h to understand actual vs. apparent storage

Symptom: Hard links created but indicator missing in UI.

Possible causes:

  1. Browser cache showing old interface
  2. UI needs refresh after enabling feature

Resolution:

  • Clear browser cache and refresh
  • Verify HARD_LINK=true in .env
  • Check application logs for errors

Hard links provide maximum value for devices with stable configurations. Enable the feature for edge networks, access layers, and standardized infrastructure where configurations change infrequently.

Track storage consumption before and after enabling hard links to quantify savings:

Terminal window
# Before enabling
du -sh /storage/app/rconfig/data/
# After 30 days with hard links enabled
du -sh /storage/app/rconfig/data/

Hard links reduce storage for unchanged configurations, but retention policies still govern how long versions are kept. Combine hard links with appropriate retention settings for optimal storage management.

Ensure operations teams understand hard links are in use, particularly for:

  • Backup and restore procedures
  • Storage capacity planning
  • Server migration operations


Terminal window
# Edit .env file
nano /var/www/html/rconfig8/current/.env
# Add or modify
HARD_LINK=true
# Restart services
systemctl restart php-fpm nginx
Terminal window
# Check link count
ls -l /storage/app/rconfig/data/[path]/config.txt
# Link count > 1 indicates hard links in use

Look for 🔗 icon in rConfig UI next to hard-linked configurations

Terminal window
# Apparent size (what hard links show)
du -h --apparent-size /storage/app/rconfig/data/
# Actual disk usage (what's physically stored)
du -h /storage/app/rconfig/data/