Add e2fsck before mounting iSCSI volume

This commit is contained in:
2022-12-15 13:21:29 +00:00
parent 2a57a0766d
commit 38ed646237
+14 -2
View File
@@ -315,10 +315,22 @@ func (d *iscsiDriver) mountVolume(v *iscsiVolume) error {
return err return err
} }
out = strings.TrimSuffix(out, "\n") device := strings.TrimSuffix(out, "\n")
// FSCK
cmd = "e2fsck -p " + device
out, errMsg = util.ExecuteCommandString(cmd)
if len(out) > 0 {
logrus.Debug(out)
}
if len(errMsg) > 0 {
err := fmt.Errorf("Unable to Check Disk: %s", errMsg)
return err
}
// Mount // Mount
cmd = "mount " + out + " " + v.Mountpoint cmd = "mount " + device + " " + v.Mountpoint
out, errMsg = util.ExecuteCommandString(cmd) out, errMsg = util.ExecuteCommandString(cmd)
if len(out) > 0 { if len(out) > 0 {