ajs124 / cryptsetup

Automatically exported from code.google.com/p/cryptsetup
GNU General Public License v2.0
0 stars 0 forks source link

dm-crypt LUKS usage incorrect #225

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I want to migrate my BackupPC data from a truecrypt container to a LUKS 
encrypted partition. Both storage devices are external USB devices.

If I recursively copy the directory structure, the destination media reports 
significantly (15x) more disk usage than the source, eg

% du -sm /media/source/*
...
1773 pc
....

% cp -R -p /media/source/pc /media/destination

% du -sm /media/destination/pc
264113 pc

What steps will reproduce the problem?
1. Recursively copy a directory from a truecrypt container to a LUKS partition 
2.
3.

What is the expected output? What do you see instead?
Should see roughly (+/- 1%) same disk usage on both media

What version of the product are you using? On what operating system?
OpenSUSE13.1
TrueCrypt7.1a
cryptsetup-1.6.2-2.1.2.x86_64

Please provide any additional information below.

Original issue reported on code.google.com by jonathan...@gmail.com on 6 Sep 2014 at 9:43

GoogleCodeExporter commented 9 years ago
Are any files in there sparse or hard-linked together?
Have you tried -d or --sparse=always ?

Original comment by a...@redhat.com on 7 Sep 2014 at 12:34

GoogleCodeExporter commented 9 years ago
Well, this is definitely not a problem of cryptsetup.

Cryptsetup is just configuring underlying encryption block device, it has no 
idea what space is allocated. Your reported problem is related to filesystem 
above the cryptsetup layer.

Anyway as Alasdair mentioned - it seems like you have some hard linked files 
which are not copied independently.

Either use suggested parameters for copy  or maybe you can to use rsync (with 
-H parameter to preserve hardlinks).

If the source and destination is of the same size, you can also directly copy 
block device using dd in this case. (And note that type of filesystem and 
options are important as well. For example, if you are using extended 
attributes, every file will have allocated more space than its size).

Anyway, closing this, the problem is unrelated to cryptsetup.

Original comment by gmazyl...@gmail.com on 7 Sep 2014 at 7:26

GoogleCodeExporter commented 9 years ago
Ok. Thanks for your guidance on this. I know BackupPC uses hard links, so I
will look into this.

Original comment by jonathan...@gmail.com on 7 Sep 2014 at 7:37