]> git.ipfire.org Git - people/ms/bricklayer.git/commitdiff
disk: Use wipefs(8) to remove any previous signatures
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 9 May 2022 16:55:19 +0000 (16:55 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 9 May 2022 16:55:19 +0000 (16:55 +0000)
wipefs(8) is a lot smarter than me trying to erase the first couple of
blocks.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/python/disk.py

index 0450b4ffccbcdd712ff1a5bf3c77f3f04e9046b5..916cce33f0c3cbff9672666f748b583397079ad9 100644 (file)
@@ -387,10 +387,8 @@ class Partition(object):
                """
                log.info("Wiping %s (%s)..." % (self.name, self.path))
 
-               zero = bytearray(1024)
-
-               with open(self.path, "wb") as f:
-                       f.write(zero)
+               # Wipes any previous signatures from this disk
+               self.bricklayer.command(["wipefs", "--all", self.path])
 
        def format(self):
                """