Cloning Hard Linked Folders to Another Drive: A Tech Support Guide

Abstract: Clone hard linked folders to another drive using rsync -a --link-dest to preserve links and save space.

Created: 2026-09-10 by

Use rsync -a --link-dest=DIR to clone hard linked folders while preserving existing links. This command creates a new backup directory where unchanged files remain as hard links to the source, saving space and time. It is ideal for incremental backups that maintain a consistent snapshot of your data structure.

Understanding Hard Links and Rsync

Hard links are filesystem entries that point to the same inode (data block) on disk. Unlike symbolic links, which are pointers to a path, hard links are indistinguishable from regular files. When you delete one hard link, the file persists as long as at least one other link exists. This property is crucial for efficient storage management, especially in backup scenarios where identical files should not consume additional disk space. Rsync is a versatile utility for synchronizing files and directories. By default, it copies files byte-by-byte, which can be slow and wasteful if many files have not changed. The --link-dest option changes this behavior. It tells rsync to compare files against a reference directory. If a file in the source matches a file in the reference directory, rsync creates a hard link to the reference file instead of copying it. This approach significantly reduces I/O operations and storage usage for repeated backups. For more details on how rsync handles periodic backups with hard links, see Transferring Periodic Backups of /mnt/tosh Using Rsync with Hard Link Handling.

Prerequisites and Setup

Before running the cloning command, ensure you have the necessary permissions and tools. You need access to both the source drive and the destination drive. The destination must support hard links; most Linux filesystems like ext4, XFS, and Btrfs do, but network filesystems or Windows drives may behave differently. First, create the destination directory structure. If you are performing an incremental backup, you likely already have previous snapshots. Identify the most recent snapshot directory. This will serve as your --link-dest target. If this is your first backup, you might use the source directory itself as the reference, though this is less common for true incremental strategies. Ensure that the rsync version installed supports --link-dest. Most modern distributions include a version that does. You can check by running rsync --version. If the output mentions "link dest" or similar capabilities, you are ready to proceed.

Executing the Clone Command

The core command structure involves specifying the archive mode, the link destination, and the source and target paths. Archive mode (-a) preserves permissions, timestamps, and ownership, which is essential for maintaining the integrity of your system files. Run the following command in your terminal:
rsync -a --link-dest=/path/to/previous/snapshot /source/directory/ /destination/new/snapshot/
Replace /path/to/previous/snapshot with the absolute path to the last successful backup. Replace /source/directory/ with the folder you want to clone. Ensure the trailing slash is included on the source to copy the contents rather than the directory itself. Finally, specify the new destination directory. If you encounter issues with large directories, consider adding the --progress flag to monitor the transfer rate. For very large datasets, the --delete option can be used to remove files in the destination that no longer exist in the source, keeping the clone in sync. However, use this cautiously to avoid accidental data loss. Related reading: Using rsync delete-excluded without implied delete for backup explains how to manage deletions safely during synchronization.

Verifying the Result

After the command completes, verify that hard links were created correctly. Use the ls -i command to list files along with their inode numbers. Compare the inode numbers of files in the new snapshot with those in the previous snapshot. If they match, the files are hard linked. You can also check the disk usage. Run du -sh /destination/new/snapshot/ and compare it with the size of the previous snapshot. If the content has not changed significantly, the new snapshot should occupy very little additional space, confirming that hard linking worked as intended. Be aware that hard links only work within the same filesystem. If your source and destination are on different physical disks or partitions, rsync will fall back to copying files. In such cases, you cannot preserve hard links across the boundary. For insights on handling sparse files during such transfers, refer to How to Shrink Sparse Files in Linux After Copying Them Without the -S Operator.

Frequently Asked Questions

Can I use --link-dest with remote destinations?

No, --link-dest requires the reference directory to be accessible locally on the machine running rsync. It compares files using local inode information, which cannot be done across network boundaries directly. You must ensure the reference snapshot is stored on the local disk before initiating the transfer.

What happens if I delete a file in the source after cloning?

Deleting a file in the source does not affect the cloned hard links in the destination. Since the destination holds its own hard link to the original inode, the data remains intact in the backup. This makes hard-linked backups safe for retention even if the source data is modified or removed.

Does --link-dest work with symlinks?

Rsync handles symbolic links separately from hard links. The -a flag preserves symlinks as symlinks. If a symlink points to a file that is hard-linked via --link-dest, the symlink in the destination will still point to the same relative path. It does not convert symlinks into hard links.

Why is my new backup taking up full disk space?

This usually occurs if the source and destination are on different filesystems, preventing hard link creation. It can also happen if the --link-dest path is incorrect or if the files have different permissions or timestamps that cause rsync to treat them as changed. Check the rsync output for any warnings about unsupported features.

Is there a risk of corrupting data with hard links?

There is no inherent risk of corruption from using hard links. However, if you accidentally modify a file in the "reference" snapshot thinking it is independent, you will overwrite the data for all clones pointing to that inode. Always treat reference snapshots as read-only to prevent unintended data loss across multiple backup versions.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More