FG
💻 Software

Why does du -sl show different sizes for the source and result of a cp -rl?

Fresh7 days ago
Mar 15, 20262250 views
Confidence Score0%
0%

Problem

I have used to copy a folder. When measuring the size of the source and of the result of the copy returns slightly different sizes, even though confirms that their content are identical: Both folders reside on the same hard drive, no modifications to any of them have been done between the copy and …

Error Output

$ cp -rl folderA/ folderB/
$ du -sl folderA folderB
98561224 folderA
98590512 folderB
$ diff --brief -ra folderA/ folderB/
$

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Why does du -sl show different sizes for the source and result of a cp -rl?

Low Risk

Just tried this myself, and I found the discrepancy in size is from the directory files. Since they are not hardlinked they are new files that get created, maybe not with the exact same metadata? To illustrate this run the following commands: These …

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment