[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Filesystem type survives formatting in debian installer?

On Sun, Feb 25, 2007 at 01:26:26PM +0100, Josef Wolf wrote:

I am trying to create a customized installation disk with the ability
to create encrypted root filesystem.  In my test installations, I noticed
that the filesystem type is not set properly when I choose to reformat
filesystems in debian installer.

This is what I am doing:

1. While doing a test install, I use "cryptsetup luksFormat /dev/hdaX"
  to create an encrypted filesystem.

2. In the next test install, I choose to reformat /dev/hdaX with ext3.

3. When the system reboots after installation, I get the error message
  that the filesystem could not be mounted causing the boot process to
  abort, and my preseed/late_command (which runs cryptsetup and copies
  the system to encrypted partition) is not run.

4. When I try to mount the filesystem manually, I get the error message
  that filesystem type cyrpto_LUKS in not known.

5. Using "mount -t ext3 /dev/hdaX /mnt" succeeds and "cat /proc/mounts"
  shows that the filesystem type is actually ext3, so the filesystem
  was actually reformatted.

Any ideas why the filesystem type is considered to be crypto_LUKS even
after it was reformatted with ext3?  I even tried to set the volume
label in the installer, but this did not help either.  After I mke2fs
manually, the filesystem type is recognized properly again.

The problem does not relate to d-i per se. What's happening is that luks creates its header in the first bytes of the partition (so generally at bytes 0 - 300 or so).

ext3 any some other file systems create their header at an offset of 2 blocks (or 1024 bytes).

You would have the same problem had the disk been used as an LVM pv previously, and the solution (for now) is to overwrite the old traces manually (something like dd if=/dev/zero of=/dev/<disk> bs=1k count=1 should do the trick, but it can also hose your entire fs).

David Härdeman

Reply to: