From ca1d25d0383b43421565c8ba0e3ad10d924c8be1 Mon Sep 17 00:00:00 2001 From: "David J. M. Karlsen" Date: Fri, 10 Sep 2021 23:51:27 +0200 Subject: [PATCH] force-format xfs-filesystems too Signed-off-by: David J. M. Karlsen --- staging/src/k8s.io/mount-utils/mount_linux.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/staging/src/k8s.io/mount-utils/mount_linux.go b/staging/src/k8s.io/mount-utils/mount_linux.go index 8b8857bdbd1..5d8949d01b1 100644 --- a/staging/src/k8s.io/mount-utils/mount_linux.go +++ b/staging/src/k8s.io/mount-utils/mount_linux.go @@ -30,7 +30,7 @@ import ( "syscall" "time" - "k8s.io/klog/v2" + "k8s.io/klog/v2" utilexec "k8s.io/utils/exec" utilio "k8s.io/utils/io" ) @@ -439,6 +439,11 @@ func (mounter *SafeFormatAndMount) formatAndMountSensitive(source string, target "-m0", // Zero blocks reserved for super-user source, } + } else if fstype == "xfs" { + args = []string{ + "-f", // force flag + source, + } } klog.Infof("Disk %q appears to be unformatted, attempting to format as type: %q with options: %v", source, fstype, args)