summaryrefslogtreecommitdiff
path: root/python/vyos/system/disk.py
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2023-12-11 11:43:05 -0600
committerJohn Estabrook <jestabro@vyos.io>2023-12-16 20:37:11 -0600
commit58dcd542f5b06c6d0e335b0476b76cde6920be80 (patch)
tree1ea7740d8c8c43665862be01b693655bbc5cd775 /python/vyos/system/disk.py
parente2a7c953be727ca8578511c39212fa4c73222a0c (diff)
downloadvyos-1x-58dcd542f5b06c6d0e335b0476b76cde6920be80.tar.gz
vyos-1x-58dcd542f5b06c6d0e335b0476b76cde6920be80.zip
image-tools: T5806: remove partition and disk signatures in cleanup
(cherry picked from commit ea30fc962049226e869171f69c6ab1879f9e7085)
Diffstat (limited to 'python/vyos/system/disk.py')
-rw-r--r--python/vyos/system/disk.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/python/vyos/system/disk.py b/python/vyos/system/disk.py
index f8e0fd1bf..b8a2c0f35 100644
--- a/python/vyos/system/disk.py
+++ b/python/vyos/system/disk.py
@@ -31,12 +31,17 @@ class DiskDetails:
def disk_cleanup(drive_path: str) -> None:
"""Clean up disk partition table (MBR and GPT)
+ Remove partition and device signatures.
Zeroize primary and secondary headers - first and last 17408 bytes
(512 bytes * 34 LBA) on a drive
Args:
drive_path (str): path to a drive that needs to be cleaned
"""
+ partitions: list[str] = partition_list(drive_path)
+ for partition in partitions:
+ run(f'wipefs -af {partition}')
+ run(f'wipefs -af {drive_path}')
run(f'sgdisk -Z {drive_path}')