mirror of https://git.48k.eu/ogclient
fs: check if ntfsresize actually succeded to shrink filesystem
According to ntfsresize.c, this retuns 0 in case nothing needs to be done. It should be safe to check for non-zero error and bail out in that case.master
parent
0f30b1349d
commit
d6c32bba5d
|
@ -260,7 +260,10 @@ def _reduce_ntfsresize(partdev):
|
|||
if new_size < size:
|
||||
cmd_resize = shlex.split(f'ntfsresize -fs {new_size:.0f} {partdev}')
|
||||
with open('/tmp/command.log', 'ab', 0) as logfile:
|
||||
subprocess.run(cmd_resize, input='y', stderr=STDOUT, encoding='utf-8')
|
||||
proc_resize = subprocess.run(cmd_resize, input='y', stderr=STDOUT, encoding='utf-8')
|
||||
if proc_resize.returncode != 0:
|
||||
logging.error(f'ntfsresize on {partdev} with {new_size:.0f} failed with {proc_resize.returncode}')
|
||||
return -1
|
||||
|
||||
return 0
|
||||
|
||||
|
|
Loading…
Reference in New Issue