Merge remote-tracking branch 'upstream/new-ddrescue-arguments' into new-ddrescue-arguments
This commit is contained in:
commit
3b3f737ed5
2 changed files with 30 additions and 30 deletions
|
|
@ -17,9 +17,10 @@ TMUX_LAYOUT = OrderedDict({
|
||||||
# ddrescue
|
# ddrescue
|
||||||
AUTO_PASS_THRESHOLDS = {
|
AUTO_PASS_THRESHOLDS = {
|
||||||
# NOTE: The scrape key is set to infinity to force a break
|
# NOTE: The scrape key is set to infinity to force a break
|
||||||
'read': 95,
|
'read-skip': 50,
|
||||||
'trim': 98,
|
'read-full': 95,
|
||||||
'scrape': float('inf'),
|
'trim': 98,
|
||||||
|
'scrape': float('inf'),
|
||||||
}
|
}
|
||||||
DDRESCUE_MAP_TEMPLATE = '''# Mapfile. Created by {name}
|
DDRESCUE_MAP_TEMPLATE = '''# Mapfile. Created by {name}
|
||||||
0x0 ? 1
|
0x0 ? 1
|
||||||
|
|
@ -36,10 +37,10 @@ DDRESCUE_SETTINGS = {
|
||||||
'--max-error-rate': {'Selected': True, 'Value': '100MiB', },
|
'--max-error-rate': {'Selected': True, 'Value': '100MiB', },
|
||||||
'--max-read-rate': {'Selected': False, 'Value': '1MiB', },
|
'--max-read-rate': {'Selected': False, 'Value': '1MiB', },
|
||||||
'--min-read-rate': {'Selected': True, 'Value': '64KiB', },
|
'--min-read-rate': {'Selected': True, 'Value': '64KiB', },
|
||||||
'--reopen-on-error': {'Selected': True, },
|
'--reopen-on-error': {'Selected': False, },
|
||||||
'--retry-passes': {'Selected': True, 'Value': '0', },
|
'--retry-passes': {'Selected': True, 'Value': '0', },
|
||||||
'--reverse': {'Selected': False, },
|
'--reverse': {'Selected': False, },
|
||||||
'--skip-size': {'Selected': True, 'Value': '0.0001,0.01', }, # Percentages of source size
|
'--skip-size': {'Selected': True, 'Value': '0.001,0.05', }, # Percentages of source size
|
||||||
'--test-mode': {'Selected': False, 'Value': 'test.map', },
|
'--test-mode': {'Selected': False, 'Value': 'test.map', },
|
||||||
'--timeout': {'Selected': True, 'Value': '30m', },
|
'--timeout': {'Selected': True, 'Value': '30m', },
|
||||||
'-vvvv': {'Selected': True, 'Hidden': True, },
|
'-vvvv': {'Selected': True, 'Hidden': True, },
|
||||||
|
|
@ -47,17 +48,19 @@ DDRESCUE_SETTINGS = {
|
||||||
'Fast': {
|
'Fast': {
|
||||||
'--max-error-rate': {'Selected': True, 'Value': '32MiB', },
|
'--max-error-rate': {'Selected': True, 'Value': '32MiB', },
|
||||||
'--min-read-rate': {'Selected': True, 'Value': '1MiB', },
|
'--min-read-rate': {'Selected': True, 'Value': '1MiB', },
|
||||||
'--reopen-on-error': {'Selected': False, },
|
|
||||||
'--timeout': {'Selected': True, 'Value': '5m', },
|
'--timeout': {'Selected': True, 'Value': '5m', },
|
||||||
},
|
},
|
||||||
'Safe': {
|
'Safe': {
|
||||||
'--max-read-rate': {'Selected': True, 'Value': '64MiB', },
|
'--max-read-rate': {'Selected': True, 'Value': '64MiB', },
|
||||||
'--min-read-rate': {'Selected': True, 'Value': '1KiB', },
|
'--min-read-rate': {'Selected': True, 'Value': '1KiB', },
|
||||||
'--reopen-on-error': {'Selected': True, },
|
|
||||||
'--skip-size': {'Selected': True, 'Value': '0.001,0.05', }, # Percentages of source size
|
|
||||||
'--timeout': {'Selected': False, 'Value': '30m', },
|
'--timeout': {'Selected': False, 'Value': '30m', },
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
DDRESCUE_SPECIFIC_PASS_SETTINGS = {
|
||||||
|
'read-skip': ['--no-scrape', '--no-trim', '--cpass=1,2'],
|
||||||
|
'read-full': ['--no-scrape', '--no-trim'],
|
||||||
|
'trim': ['--no-scrape'],
|
||||||
|
}
|
||||||
DRIVE_POWEROFF_TIMEOUT = 90
|
DRIVE_POWEROFF_TIMEOUT = 90
|
||||||
PARTITION_TYPES = {
|
PARTITION_TYPES = {
|
||||||
'GPT': {
|
'GPT': {
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,11 @@ import psutil
|
||||||
import pytz
|
import pytz
|
||||||
|
|
||||||
from wk import cfg, debug, exe, io, log, net, osticket, std, tmux
|
from wk import cfg, debug, exe, io, log, net, osticket, std, tmux
|
||||||
from wk.cfg.ddrescue import DDRESCUE_MAP_TEMPLATE, DDRESCUE_SETTINGS
|
from wk.cfg.ddrescue import (
|
||||||
|
DDRESCUE_MAP_TEMPLATE,
|
||||||
|
DDRESCUE_SETTINGS,
|
||||||
|
DDRESCUE_SPECIFIC_PASS_SETTINGS,
|
||||||
|
)
|
||||||
from wk.hw import obj as hw_obj
|
from wk.hw import obj as hw_obj
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -107,11 +111,11 @@ SETTING_PRESETS = (
|
||||||
'Safe',
|
'Safe',
|
||||||
)
|
)
|
||||||
STATUS_COLORS = {
|
STATUS_COLORS = {
|
||||||
'Passed': 'GREEN',
|
'Passed': 'GREEN',
|
||||||
'Aborted': 'YELLOW',
|
'Aborted': 'YELLOW',
|
||||||
'Skipped': 'YELLOW',
|
'Skipped': 'YELLOW',
|
||||||
'Working': 'YELLOW',
|
'Working': 'YELLOW',
|
||||||
'ERROR': 'RED',
|
'ERROR': 'RED',
|
||||||
}
|
}
|
||||||
TIMEZONE = pytz.timezone(cfg.main.LINUX_TIME_ZONE)
|
TIMEZONE = pytz.timezone(cfg.main.LINUX_TIME_ZONE)
|
||||||
|
|
||||||
|
|
@ -133,9 +137,10 @@ class BlockPair():
|
||||||
self.map_path = None
|
self.map_path = None
|
||||||
self.size = source.details['size']
|
self.size = source.details['size']
|
||||||
self.status = OrderedDict({
|
self.status = OrderedDict({
|
||||||
'read': 'Pending',
|
'read-skip': 'Pending',
|
||||||
'trim': 'Pending',
|
'read-full': 'Pending',
|
||||||
'scrape': 'Pending',
|
'trim': 'Pending',
|
||||||
|
'scrape': 'Pending',
|
||||||
})
|
})
|
||||||
self.view_map = 'DISPLAY' in os.environ or 'WAYLAND_DISPLAY' in os.environ
|
self.view_map = 'DISPLAY' in os.environ or 'WAYLAND_DISPLAY' in os.environ
|
||||||
|
|
||||||
|
|
@ -326,10 +331,9 @@ class BlockPair():
|
||||||
|
|
||||||
# Mark future passes as skipped if applicable
|
# Mark future passes as skipped if applicable
|
||||||
if percent == 100:
|
if percent == 100:
|
||||||
if pass_name == 'read':
|
status_keys = list(self.status.keys())
|
||||||
self.status['trim'] = 'Skipped'
|
for i in status_keys[status_keys.index(pass_name)+1:]:
|
||||||
if pass_name in ('read', 'trim'):
|
self.status[status_keys[i]] = 'Skipped'
|
||||||
self.status['scrape'] = 'Skipped'
|
|
||||||
|
|
||||||
|
|
||||||
class State():
|
class State():
|
||||||
|
|
@ -1306,14 +1310,7 @@ def build_ddrescue_cmd(block_pair, pass_name, settings_menu):
|
||||||
if (block_pair.destination.is_block_device()
|
if (block_pair.destination.is_block_device()
|
||||||
or block_pair.destination.is_char_device()):
|
or block_pair.destination.is_char_device()):
|
||||||
cmd.append('--force')
|
cmd.append('--force')
|
||||||
if pass_name == 'read':
|
cmd.extend(DDRESCUE_SPECIFIC_PASS_SETTINGS.get(pass_name, []))
|
||||||
cmd.extend(['--no-trim', '--no-scrape'])
|
|
||||||
elif pass_name == 'trim':
|
|
||||||
# Allow trimming
|
|
||||||
cmd.append('--no-scrape')
|
|
||||||
elif pass_name == 'scrape':
|
|
||||||
# Allow trimming and scraping
|
|
||||||
pass
|
|
||||||
|
|
||||||
# Fix domain size based on starting position
|
# Fix domain size based on starting position
|
||||||
domain_size = block_pair.size
|
domain_size = block_pair.size
|
||||||
|
|
@ -2313,7 +2310,7 @@ def run_recovery(state, main_menu, settings_menu, dry_run=True):
|
||||||
)
|
)
|
||||||
|
|
||||||
# Run pass(es)
|
# Run pass(es)
|
||||||
for pass_name in ('read', 'trim', 'scrape'):
|
for pass_name in ('read-skip', 'read-full', 'trim', 'scrape'):
|
||||||
abort = False
|
abort = False
|
||||||
|
|
||||||
# Skip to next pass
|
# Skip to next pass
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue