Mount backup shares before adding block-pairs
* Helps ensure saving map files to non-volatile storage * Addresses issue #74
This commit is contained in:
parent
ce275d86a4
commit
867df93c30
2 changed files with 17 additions and 3 deletions
|
|
@ -61,9 +61,10 @@ class BlockPair():
|
||||||
if self.mode == 'clone':
|
if self.mode == 'clone':
|
||||||
# Cloning
|
# Cloning
|
||||||
self.dest_path = dest.path
|
self.dest_path = dest.path
|
||||||
self.map_path = '{pwd}/Clone_{prefix}.map'.format(
|
self.map_path = '{cwd}/Clone_{prefix}.map'.format(
|
||||||
pwd=os.path.realpath(global_vars['Env']['PWD']),
|
cwd=os.path.realpath(os.getcwd()),
|
||||||
prefix=source.prefix)
|
prefix=source.prefix,
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
# Imaging
|
# Imaging
|
||||||
self.dest_path = '{path}/{prefix}.dd'.format(
|
self.dest_path = '{path}/{prefix}.dd'.format(
|
||||||
|
|
@ -774,6 +775,7 @@ def is_writable_filesystem(dir_obj):
|
||||||
|
|
||||||
def menu_ddrescue(source_path, dest_path, run_mode):
|
def menu_ddrescue(source_path, dest_path, run_mode):
|
||||||
"""ddrescue menu."""
|
"""ddrescue menu."""
|
||||||
|
map_dir = '{}/{}'.format(MAP_DIR, global_vars['Date-Time'])
|
||||||
source = None
|
source = None
|
||||||
dest = None
|
dest = None
|
||||||
if source_path:
|
if source_path:
|
||||||
|
|
@ -790,6 +792,17 @@ def menu_ddrescue(source_path, dest_path, run_mode):
|
||||||
dest = select_path(skip_device=source)
|
dest = select_path(skip_device=source)
|
||||||
dest.self_check()
|
dest.self_check()
|
||||||
|
|
||||||
|
# Get Ticket ID
|
||||||
|
# TODO
|
||||||
|
# map_dir = '{}/{}_{}'.format(MAP_DIR, ticket_id, ticket_name)
|
||||||
|
|
||||||
|
# Mount backup shares
|
||||||
|
mount_backup_shares(read_write=True)
|
||||||
|
|
||||||
|
# Move to safe working dir
|
||||||
|
os.makedirs(map_dir, exist_ok=True)
|
||||||
|
os.chdir(map_dir)
|
||||||
|
|
||||||
# Build BlockPairs
|
# Build BlockPairs
|
||||||
state = RecoveryState(run_mode, source, dest)
|
state = RecoveryState(run_mode, source, dest)
|
||||||
if run_mode == 'clone':
|
if run_mode == 'clone':
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import re
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
|
||||||
# General
|
# General
|
||||||
|
MAP_DIR = '/Backups/Anaconda'
|
||||||
RECOMMENDED_FSTYPES = ['ext3', 'ext4', 'xfs']
|
RECOMMENDED_FSTYPES = ['ext3', 'ext4', 'xfs']
|
||||||
USAGE = """ {script_name} clone [source [destination]]
|
USAGE = """ {script_name} clone [source [destination]]
|
||||||
{script_name} image [source [destination]]
|
{script_name} image [source [destination]]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue