# Strange behavior after HDD backup



## freeme (Aug 19, 2010)

Hi,

I've just mv'ed the contents of a 500GB drive to a recently-mounted 2TB drive and the 2TB drive is now at 71% capacity:


```
Filesystem  1K-blocks        Used     Avail Capacity  Mounted on
/dev/ad4s1a    1012974     510910    421028    55%    /
devfs                1          1         0   100%    /dev
/dev/ad4s1d     507630         12    467008     0%    /tmp
/dev/ad4s1f  459306336   12423906 410137924     3%    /usr
/dev/ad4s1e   10154158      33918   9307908     0%    /var
/dev/ad6s1d  473012190  143037298 292133918    33%    /backups
/dev/ad5s1d 1892041028 1242099814 498577932    71%    /archive
```

Any idea how this is possible? Any input would be greatly appreciated. Thanks for your help.


----------



## wblock@ (Aug 19, 2010)

You mean how did the contents grow?  That would probably be hardlinked files copied as files instead of hard links.  Take /rescue for an example.  Instead of one 4M binary, you get 140 4M binaries...

rsync(1) can copy hardlinks with -H, or dump(8) | restore(8), or probably tar(1) -c | tar -x.


----------



## freeme (Aug 19, 2010)

Since the contents of the original drive are gone, how best can I salvage the data to make it smaller?


----------



## wblock@ (Aug 19, 2010)

In theory, a program could traverse the whole filesystem, calculating md5s for every file, then creating hard links for all the ones that are the same.  mtree(8) might be a start.

In practice, I don't know of anything specific to do that.


----------



## freeme (Aug 19, 2010)

It may be because the drive contained partially-downloaded torrent data. I've noticed that when a torrent is launched, oftentimes the files in the directories created are the full size--yet they're not *really* the full size--just containers. My guess is that when the files were copied, the full amount of blocks were allocated on the new disk, causing it to appear bloated even though it's really not. Does that sound plausible?


----------



## wblock@ (Aug 19, 2010)

Those would be sparse files.  Apparently rsync(1) can copy sparse files correctly, too.


----------

