Show SMART data for both devices in ddrescue-tui
This commit is contained in:
parent
7499639c5c
commit
ebd1bbda18
1 changed files with 22 additions and 19 deletions
|
|
@ -87,11 +87,6 @@ REGEX_REMAINING_TIME = re.compile(
|
||||||
r'\s*(?P<na>n/a)?',
|
r'\s*(?P<na>n/a)?',
|
||||||
re.IGNORECASE
|
re.IGNORECASE
|
||||||
)
|
)
|
||||||
PANE_RATIOS = (
|
|
||||||
12, # SMART
|
|
||||||
22, # ddrescue progress
|
|
||||||
4, # Journal (kernel messages)
|
|
||||||
)
|
|
||||||
PLATFORM = std.PLATFORM
|
PLATFORM = std.PLATFORM
|
||||||
RECOMMENDED_FSTYPES = re.compile(r'^(ext[234]|ntfs|xfs)$')
|
RECOMMENDED_FSTYPES = re.compile(r'^(ext[234]|ntfs|xfs)$')
|
||||||
if PLATFORM == 'Darwin':
|
if PLATFORM == 'Darwin':
|
||||||
|
|
@ -1937,11 +1932,14 @@ def run_ddrescue(state, block_pair, pass_name, settings, dry_run=True) -> None:
|
||||||
'Press Enter to return to main menu...', end='', flush=True,
|
'Press Enter to return to main menu...', end='', flush=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
def _update_smart_pane() -> None:
|
def _update_smart_panes() -> None:
|
||||||
"""Update SMART pane every 30 seconds."""
|
"""Update SMART panes every 30 seconds."""
|
||||||
update_smart_details(state.source)
|
|
||||||
now = datetime.datetime.now(tz=TIMEZONE).strftime('%Y-%m-%d %H:%M %Z')
|
now = datetime.datetime.now(tz=TIMEZONE).strftime('%Y-%m-%d %H:%M %Z')
|
||||||
with open(f'{state.log_dir}/smart.out', 'w', encoding='utf-8') as _f:
|
for dev_str in ('source', 'destination'):
|
||||||
|
dev = getattr(state, dev_str)
|
||||||
|
out_path = f'{state.log_dir}/smart_{dev_str}.out'
|
||||||
|
update_smart_details(dev)
|
||||||
|
with open(out_path, 'w', encoding='utf-8') as _f:
|
||||||
_f.write(
|
_f.write(
|
||||||
ansi.color_string(
|
ansi.color_string(
|
||||||
['SMART Attributes', f'Updated: {now}\n'],
|
['SMART Attributes', f'Updated: {now}\n'],
|
||||||
|
|
@ -1949,7 +1947,7 @@ def run_ddrescue(state, block_pair, pass_name, settings, dry_run=True) -> None:
|
||||||
sep='\t\t',
|
sep='\t\t',
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
_f.write('\n'.join(state.source.generate_report(header=False)))
|
_f.write('\n'.join(dev.generate_report(header=False)))
|
||||||
|
|
||||||
# Dry run
|
# Dry run
|
||||||
if dry_run:
|
if dry_run:
|
||||||
|
|
@ -1972,7 +1970,7 @@ def run_ddrescue(state, block_pair, pass_name, settings, dry_run=True) -> None:
|
||||||
while True:
|
while True:
|
||||||
if _i % 30 == 0:
|
if _i % 30 == 0:
|
||||||
# Update SMART pane
|
# Update SMART pane
|
||||||
_update_smart_pane()
|
_update_smart_panes()
|
||||||
|
|
||||||
# Check destination
|
# Check destination
|
||||||
warning_message = check_destination_health(state.destination)
|
warning_message = check_destination_health(state.destination)
|
||||||
|
|
@ -2069,7 +2067,12 @@ def run_recovery(state: State, main_menu, settings_menu, dry_run=True) -> None:
|
||||||
state.ui.add_info_pane(
|
state.ui.add_info_pane(
|
||||||
percent=50,
|
percent=50,
|
||||||
update_layout=False,
|
update_layout=False,
|
||||||
watch_file=f'{state.log_dir}/smart.out',
|
watch_file=f'{state.log_dir}/smart_source.out',
|
||||||
|
)
|
||||||
|
state.ui.add_info_pane(
|
||||||
|
percent=50,
|
||||||
|
update_layout=False,
|
||||||
|
watch_file=f'{state.log_dir}/smart_destination.out',
|
||||||
)
|
)
|
||||||
if PLATFORM == 'Linux':
|
if PLATFORM == 'Linux':
|
||||||
state.ui.add_worker_pane(lines=4, cmd='journal-datarec-monitor')
|
state.ui.add_worker_pane(lines=4, cmd='journal-datarec-monitor')
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue