summaryrefslogtreecommitdiff
path: root/python/vyos/system
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2023-12-11 11:43:05 -0600
committerJohn Estabrook <jestabro@vyos.io>2023-12-12 09:51:16 -0600
commitea30fc962049226e869171f69c6ab1879f9e7085 (patch)
tree1b36e0d1aa80305f584aa42142c99ad9b04c3cfe /python/vyos/system
parent138fe52743703aa771f388da026816c671e7d25b (diff)
downloadvyos-1x-ea30fc962049226e869171f69c6ab1879f9e7085.tar.gz
vyos-1x-ea30fc962049226e869171f69c6ab1879f9e7085.zip
image-tools: T5806: remove partition and disk signatures in cleanup
Diffstat (limited to 'python/vyos/system')
-rw-r--r--python/vyos/system/disk.py5
-rw-r--r--python/vyos/system/raid.py3
2 files changed, 5 insertions, 3 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}')
diff --git a/python/vyos/system/raid.py b/python/vyos/system/raid.py
index 13b99fa69..616d1adf7 100644
--- a/python/vyos/system/raid.py
+++ b/python/vyos/system/raid.py
@@ -54,9 +54,6 @@ def raid_create(raid_members: list[str],
drive: str = disk.partition_parent(part)
command: str = f'sgdisk --typecode=3:A19D880F-05FC-4D3B-A006-743F0F84911E {drive}'
cmd(command)
- for part in raid_members:
- command: str = f'mdadm --zero-superblock {part}'
- cmd(command)
command: str = f'mdadm --create /dev/{raid_name} -R --metadata=1.0 \
--raid-devices={raid_devices_num} --level={raid_level} \
{raid_members_str}'