Properly handle damaged filesystems
This commit is contained in:
parent
da0dae2083
commit
075e25462e
2 changed files with 10 additions and 3 deletions
|
|
@ -116,8 +116,13 @@ def get_partition_details(disk, partition):
|
|||
|
||||
if 'Letter' in details:
|
||||
# Disk usage
|
||||
tmp = shutil.disk_usage('{}:\\'.format(details['Letter']))
|
||||
details['Used Space'] = human_readable_size(tmp.used)
|
||||
try:
|
||||
tmp = psutil.disk_usage('{}:\\'.format(details['Letter']))
|
||||
except OSError as err:
|
||||
details['FileSystem'] = 'Unknown'
|
||||
details['Error'] = err.strerror
|
||||
else:
|
||||
details['Used Space'] = human_readable_size(tmp.used)
|
||||
|
||||
# fsutil details
|
||||
cmd = [
|
||||
|
|
@ -146,7 +151,7 @@ def get_partition_details(disk, partition):
|
|||
details['Name'] = details.get('Volume Name', '')
|
||||
|
||||
# Set FileSystem Type
|
||||
if details.get('FileSystem', '') != 'RAW':
|
||||
if details.get('FileSystem', '') not in ['RAW', 'Unknown']:
|
||||
details['FileSystem'] = details.get('File System Name', 'Unknown')
|
||||
|
||||
return details
|
||||
|
|
|
|||
|
|
@ -125,6 +125,8 @@ def menu_backup():
|
|||
data = par['Display String']
|
||||
if par['Number'] in disk['Bad Partitions']:
|
||||
show_data(message=message, data=data, width=30, warning=True)
|
||||
if 'Error' in par:
|
||||
show_data(message='', data=par['Error'], error=True)
|
||||
elif par['Image Exists']:
|
||||
show_data(message=message, data=data, width=30, info=True)
|
||||
else:
|
||||
|
|
|
|||
Loading…
Reference in a new issue