From e87a1c8364158d0a40edaa984ccb7606e4243a1a Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sat, 4 Dec 2021 07:34:23 +0100 Subject: op-mode: disk: T4045: bugfix "format disk like " (cherry picked from commit 4207b4c264312fc496722874ec52e2db834dec37) --- src/op_mode/format_disk.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/op_mode/format_disk.py b/src/op_mode/format_disk.py index b68948e40..b3ba44e87 100755 --- a/src/op_mode/format_disk.py +++ b/src/op_mode/format_disk.py @@ -43,10 +43,11 @@ def is_busy(disk: str): def backup_partitions(disk: str): """Save sfdisk partitions output to a backup file""" - device_path = '/dev/' + disk - backup_ts = datetime.now().strftime('%Y-%m-%d-%H:%M') - backup_file = '/var/tmp/backup_{}.{}'.format(disk, backup_ts) - cmd(f'sudo /sbin/sfdisk -d {device_path} > {backup_file}') + device_path = f'/dev/{disk}' + backup_ts = datetime.now().strftime('%Y%m%d-%H%M') + backup_file = f'/var/tmp/backup_{disk}.{backup_ts}' + call(f'sfdisk -d {device_path} > {backup_file}') + print(f'Partition table backup saved to {backup_file}') def list_partitions(disk: str): -- cgit v1.2.3