mirror of
https://github.com/aljazceru/kata-containers.git
synced 2026-01-01 05:24:19 +01:00
Based on https://gitlab.com/cryptsetup/cryptsetup/-/issues/525 1. When --no-wipe is used, the device will have invalid checksums 2. mkfs.ext4 would fail on an un-wiped device due to reads of pages with invalid checksums 3. To make mkfs.ext4 work - Perform a dry run to figure out which sectors (pages) mkfs.ext4 will write to. - Perform directe writes to these pages to ensure that they will have valid checksums - Invoke mkfs.ext4 again to perform initialization 4 Use lazy_journal_init option with mkfs.ext4 to lazily initialize the journal. According to the man pages, "This speeds up file system initialization noticeably, but carries some small risk if the system crashes before the journal has been overwritten entirely one time." Since the storage is ephemeral, not expected to survive a system crash/power cycle, it is safe to use lazy_journal_init. Fixes #5329 Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>