summaryrefslogtreecommitdiff
path: root/python/vyos/system/disk.py
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2023-12-13 18:45:48 -0600
committerGitHub <noreply@github.com>2023-12-13 18:45:48 -0600
commit0d6b2d8669f88a12b7edcd88e086939c3b54b904 (patch)
tree2418944931a418bac54d31625086e08f7ca5d1ae /python/vyos/system/disk.py
parent671d012af37729601d3cdfba65beb1daf68229a3 (diff)
parente3cd779d0bd8dd8be6231c7b2028326a03e6a06c (diff)
downloadveeos-1x-0d6b2d8669f88a12b7edcd88e086939c3b54b904.tar.gz
veeos-1x-0d6b2d8669f88a12b7edcd88e086939c3b54b904.zip
Merge pull request #2621 from jestabro/clear-raid-on-install
image-tools: T5806: clear previous raid configs on install
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}')