On Sat, Apr 02, 2016 at 01:41:53PM -0600, Chris Murphy wrote: > On Thu, Mar 31, 2016 at 11:57 PM, Marc Haber > <mh+linux-bt...@zugschlus.de> wrote: > > On Thu, Mar 31, 2016 at 11:16:30PM +0200, Kai Krakow wrote: > >> Am Thu, 31 Mar 2016 23:00:04 +0200 > >> schrieb Marc Haber <mh+linux-bt...@zugschlus.de>: > >> > I find it somewhere between funny and disturbing that the first call > >> > of btrfs check made my kernel log the following: > >> > Mar 31 22:45:36 fan kernel: [ 6253.178264] EXT4-fs (dm-31): mounted > >> > filesystem with ordered data mode. Opts: (null) Mar 31 22:45:38 fan > >> > kernel: [ 6255.361328] BTRFS: device label fanbtr devid 1 transid > >> > 67526 /dev/dm-31 > >> > > >> > No, the filesystem was not converted, it was directly created as > >> > btrfs, and no, I didn't try mounting it. > >> > >> I suggest that your partition contained ext4 before, and you didn't run > >> wipefs before running mkfs.btrfs. > > > > I cryptsetup luksFormat'ted the partition before I mkfs.btrfs'ed it. > > That should do a much better job than wipefsing it, shouldnt it? > > Not really. The first btrfs super is at 64K. The second at 64M. The > third at 256G. While wipefs will remove the magic only on the first, > mkfs.btrfs will take care of all three. And luksFormat only overwrites > the first 132K of a block device. There's a scant chance of bugs > related to previous filesystems not being erased, I think this is more > likely when mixing and matching filesystems just because the > superblocks for each filesystem aren't in the same location.
If I do: umount /dev/mapper/foo cryptsetup close /dev/mapper/foo cryptsetup luksFormat /dev/mapper/pv-c_foo cryptsetup open /dev/mapper/pv-c_foo foo and the contents of /dev/mapper/foo would randomly resemble its previous contents afterwards, I would be _very_ disturbed. During the luksFormat process, a new random symmetric key is created, and overwrites the old random symmetric key in the LUKS header. Therefore, the following crypto operations are _very_ unlikely to produce something that resembles an ext4 fileystem. Even if I did: umount /dev/mapper/foo cryptsetup close /dev/mapper/foo mkfs.btrfs /dev/mapper/pv-c_foo (assuming I previously did cryptsetup open /dev/mapper/pv-c_foo foo) I would be _very_ surprised if the kernel would find something resembling and ext4 file system on /dev/mapper/pv-c_foo. > If you're concerned about traces of previous file systems, then use > the dmcrypt device itself, rather than merely using the original block > device where merely 132K at the beginning has been overwritten. > Everytime you format a device, the resulting dmcrypt logical device is > in effect full of completely random data. A new random key is > generated each time you use luksFormat, even if you're using the same > passphrase. That's what I am saying. I must be missing something. Greetings Marc -- ----------------------------------------------------------------------------- Marc Haber | "I don't trust Computers. They | Mailadresse im Header Leimen, Germany | lose things." Winona Ryder | Fon: *49 6224 1600402 Nordisch by Nature | How to make an American Quilt | Fax: *49 6224 1600421 -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html