diff options
author | Dan Bungert <[email protected]> | 2024-07-12 12:27:34 -0600 |
---|---|---|
committer | Dan Bungert <[email protected]> | 2024-07-15 09:10:07 -0600 |
commit | 810f63fd1670c70f4177014c80c165ae061b02aa (patch) | |
tree | a9cc182c6c28e5f38a524807349627348a719ab5 | |
parent | e815cc6ae20cbadf3153b387a8076c202e91cf7f (diff) |
block: quick_zero wipe disk after partitions
If we wipe the disk, then attempt to wipe partitions under the disk, we
are racing the existance of those partitions and may get inconsistent
results.
If we reverse that order and wipe the partitions first this should not
happen.
LP: #2061073
-rw-r--r-- | curtin/block/__init__.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/curtin/block/__init__.py b/curtin/block/__init__.py index 2e19467a..921e1929 100644 --- a/curtin/block/__init__.py +++ b/curtin/block/__init__.py @@ -1227,11 +1227,10 @@ def wipe_file(path, reader=None, buflen=4 * 1024 * 1024, exclusive=True): def quick_zero(path, partitions=True, exclusive=True): """ - call wipefs -a -f on path, then zero 1M at front, 1M at end - if this is a block device and partitions is true, then - zero 1M at front and end of each partition. + Call wipefs -a -f on path, then zero 1M at front, 1M at end. + If this is a block device and partitions is true, then + zero 1M at front and end of each partition before zeroing path. """ - util.subp(['wipefs', '--all', '--force', path]) buflen = 1024 count = 1024 zero_size = buflen * count @@ -1252,6 +1251,8 @@ def quick_zero(path, partitions=True, exclusive=True): pt, kname, ptnum) quick_zero(pt, partitions=False) + util.subp(['wipefs', '--all', '--force', path]) + LOG.debug("wiping 1M on %s at offsets %s", path, offsets) util.not_exclusive_retry( zero_file_at_offsets, |