Skip to contentSkip to conversation

cryptsetup option to fix leftovers from old filesystems

dm-crypt Thomas Bächler 3 participants 3 messages Aug 30, 2009 – Aug 31, 2009

lore
Share & tools
lore
#0 lore raw

We have encountered a problem with blkid that is caused by cryptsetup not cleaning superblocks of old filesystems on luksFormat. The problem has been fixed in 1.0.7, however old LUKS volumes still suffer from this problem. Please read this thread for details:

http://thread.gmane.org/gmane.linux.utilities.util-linux-ng/2563

What I would request is an option to "clean" the unused area in the LUKS header up to the start of the payload, such that for example an old ext2 magic is removed. All that without destroying the used areas in the LUKS header, of course.

I'm not very familiar with the LUKS code or on-disk format, so I would be greatful if anyone who is would implement such a feature. Thanks for your replies.

Thomas

#1 lore raw
Quoted 7 lines · Thomas Bächler

We have encountered a problem with blkid that is caused by cryptsetup not cleaning superblocks of old filesystems on luksFormat. The problem has been fixed in 1.0.7, however old LUKS volumes still suffer from this problem. Please read this thread for details:

http://thread.gmane.org/gmane.linux.utilities.util-linux-ng/2563

Quoted 8 lines

What I would request is an option to "clean" the unused area in the LUKS header up to the start of the payload, such that for example an old ext2 magic is removed. All that without destroying the used areas in the LUKS header, of course.

I'm not very familiar with the LUKS code or on-disk format, so I would be greatful if anyone who is would implement such a feature. Thanks for your replies.

Hi Thomas,

I don't think we need implement any clean function, new version already wipes that area.

Because visible LUKS header is written in first 2 sectors and keyslot area always begins on 4k offset, you can use this command to wipe unused area with possible old signature (at least this works for swap/luks signature mismatch):

dd if=/dev/zero of=<device> bs=512 seek=2 count=6

But please create backup before trying this... ;-)

(btw mkswap should clean LUKS signature too - try mkswap over old LUKS and then blkid:-)

Milan
--
[email protected]

#2 lore raw

Hi Milan,

Quoted 2 lines · Milan Broz

(btw mkswap should clean LUKS signature too - try mkswap over old LUKS and then blkid:-)

this problem should be fixed, util-linux-ng 2.15 (May 2009):

commit ff3bed806863d1c2075d0efda70b39ea6af9ecba
Author: Karel Zak <[email protected]>
Date: Thu Mar 12 16:01:59 2009 +0100
Subject: mkswap: zap bootbits

Karel

Signature · 1 line
 Karel Zak  <[email protected]>