def _fsck(device, _partition):
"""
Check filesystem on partition
Note: xfs_repair returns immediately on success, but takes 3m39s to fail
on some broken filesystems. Not good for automation.
"""
prefix = ''
if 'nvme' in device:
prefix = 'p'
# cmd = "/sbin/fsck -t xfs -n {}{}{}".format(device, prefix, partition)
cmd = "/usr/sbin/xfs_admin -u {}{}{}".format(device, prefix, _partition)
log.info(cmd)
proc = Popen(cmd, stdout=PIPE, stderr=PIPE, shell=True)
proc.wait()
log.debug(pprint.pformat(proc.stdout.read()))
log.debug(pprint.pformat(proc.stderr.read()))
log.debug("xfs_admin: {}".format(proc.returncode))
return proc.returncode == 0
评论列表
文章目录