Repository: kubernetes-sigs/gcp-compute-persistent-disk-csi-driver
Pull request #2095 (2025-05-19 10:49:24)

Bump the k8s-dependencies group with 5 updates
Bumps the k8s-dependencies group with 5 updates:

| Package | From | To |
| --- | --- | --- |
| [k8s.io/api](https://github.com/kubernetes/api) | `0.33.0` | `0.33.1` |
| [k8s.io/apimachinery](https://github.com/kubernetes/apimachinery) | `0.33.0` | `0.33.1` |
| [k8s.io/cloud-provider](https://github.com/kubernetes/cloud-provider) | `0.33.0` | `0.33.1` |
| [k8s.io/component-base](https://github.com/kubernetes/component-base) | `0.33.0` | `0.33.1` |
| [k8s.io/mount-utils](https://github.com/kubernetes/mount-utils) | `0.33.0` | `0.33.1` |

Updates `k8s.io/api` from 0.33.0 to 0.33.1
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/kubernetes/api/commit/04f698e1bd3423a362c0cf87a71b7335d3e7acfc"><code>04f698e</code></a> Update dependencies to v0.33.1 tag</li>
<li>See full diff in <a href="https://github.com/kubernetes/api/compare/v0.33.0...v0.33.1">compare view</a></li>
</ul>
</details>
<br />

Updates `k8s.io/apimachinery` from 0.33.0 to 0.33.1
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/kubernetes/apimachinery/commit/173776a0582da70432e19d16eca025c451600ae8"><code>173776a</code></a> Merge pull request <a href="https://redirect.github.com/kubernetes/apimachinery/issues/131708">#131708</a><code>tigrato/automated-cherry-pick-of-#131702</code></li>
<li><a href="https://github.com/kubernetes/apimachinery/commit/a3d1fde23c29a416d149d9cfc8e249643d691311"><code>a3d1fde</code></a> fix: fixes a possible panic in <code>NewYAMLToJSONDecoder</code></li>
<li>See full diff in <a href="https://github.com/kubernetes/apimachinery/compare/v0.33.0...v0.33.1">compare view</a></li>
</ul>
</details>
<br />

Updates `k8s.io/cloud-provider` from 0.33.0 to 0.33.1
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/kubernetes/cloud-provider/commit/13c25cdee68ac27da06c59025ce16eb4ce63bd47"><code>13c25cd</code></a> Update dependencies to v0.33.1 tag</li>
<li>See full diff in <a href="https://github.com/kubernetes/cloud-provider/compare/v0.33.0...v0.33.1">compare view</a></li>
</ul>
</details>
<br />

Updates `k8s.io/component-base` from 0.33.0 to 0.33.1
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/kubernetes/component-base/commit/849956d204d0bffce8c6a59aeb63ce38ed6036d0"><code>849956d</code></a> Update dependencies to v0.33.1 tag</li>
<li>See full diff in <a href="https://github.com/kubernetes/component-base/compare/v0.33.0...v0.33.1">compare view</a></li>
</ul>
</details>
<br />

Updates `k8s.io/mount-utils` from 0.33.0 to 0.33.1
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/kubernetes/mount-utils/commit/92a975a8d616b0d6491199c00f017b142bf3ec05"><code>92a975a</code></a> Merge pull request <a href="https://redirect.github.com/kubernetes/mount-utils/issues/131636">#131636</a><code>gnufied/automated-cherry-pick-of-#131568</code></li>
<li><a href="https://github.com/kubernetes/mount-utils/commit/b41b874e8f7f7b2d462fdf04e91e13aae8a13123"><code>b41b874</code></a> Disable size check for xfs/ext3/ext4 filesystems before expansion</li>
<li><a href="https://github.com/kubernetes/mount-utils/commit/95e2a453183d8bf917a73c1110dc60a6da03f270"><code>95e2a45</code></a> Disable disk size checking when calling NeedsResize function</li>
<li>See full diff in <a href="https://github.com/kubernetes/mount-utils/compare/v0.33.0...v0.33.1">compare view</a></li>
</ul>
</details>
<br />


Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore <dependency name> major version` will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself)
- `@dependabot ignore <dependency name> minor version` will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself)
- `@dependabot ignore <dependency name>` will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself)
- `@dependabot unignore <dependency name>` will remove all of the ignore conditions of the specified dependency
- `@dependabot unignore <dependency name> <ignore condition>` will remove the ignore condition of the specified dependency and ignore conditions


</details>


Patch:
diff --git a/go.mod b/go.mod
index e900624d..7c99c8af 100644
--- a/go.mod
+++ b/go.mod
@@ -1,6 +1,7 @@
 module sigs.k8s.io/gcp-compute-persistent-disk-csi-driver
 
-go 1.23.0
+go 1.24.0
+
 toolchain go1.24.1
 
 require (
@@ -31,13 +32,13 @@ require (
 	google.golang.org/grpc v1.71.0
 	google.golang.org/protobuf v1.36.6
 	gopkg.in/gcfg.v1 v1.2.3
-	k8s.io/api v0.33.0
-	k8s.io/apimachinery v0.33.0
+	k8s.io/api v0.33.1
+	k8s.io/apimachinery v0.33.1
 	k8s.io/client-go v11.0.1-0.20190805182717-6502b5e7b1b5+incompatible
-	k8s.io/cloud-provider v0.33.0
-	k8s.io/component-base v0.33.0
+	k8s.io/cloud-provider v0.33.1
+	k8s.io/component-base v0.33.1
 	k8s.io/klog/v2 v2.130.1
-	k8s.io/mount-utils v0.33.0
+	k8s.io/mount-utils v0.33.1
 	k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738
 	sigs.k8s.io/boskos v0.0.0-20220711194915-6cb8a6fb2dd1
 )
diff --git a/go.sum b/go.sum
index e288fd5c..36e7bd95 100644
--- a/go.sum
+++ b/go.sum
@@ -2489,8 +2489,8 @@ k8s.io/api v0.17.4/go.mod h1:5qxx6vjmwUVG2nHQTKGlLts8Tbok8PzHl4vHtVFuZCA=
 k8s.io/api v0.17.6/go.mod h1:1jKVwkj0UZ4huak/yRt3MFfU5wc32+B41SkNN5HhyFg=
 k8s.io/api v0.21.1/go.mod h1:FstGROTmsSHBarKc8bylzXih8BLNYTiS3TZcsoEDg2s=
 k8s.io/api v0.32.2/go.mod h1:hKlhk4x1sJyYnHENsrdCWw31FEmCijNGPJO5WzHiJ6Y=
-k8s.io/api v0.33.0 h1:yTgZVn1XEe6opVpP1FylmNrIFWuDqe2H0V8CT5gxfIU=
-k8s.io/api v0.33.0/go.mod h1:CTO61ECK/KU7haa3qq8sarQ0biLq2ju405IZAd9zsiM=
+k8s.io/api v0.33.1 h1:tA6Cf3bHnLIrUK4IqEgb2v++/GYUtqiu9sRVk3iBXyw=
+k8s.io/api v0.33.1/go.mod h1:87esjTn9DRSRTD4fWMXamiXxJhpOIREjWOSjsW1kEHw=
 k8s.io/apiextensions-apiserver v0.0.0-20190918201827-3de75813f604/go.mod h1:7H8sjDlWQu89yWB3FhZfsLyRCRLuoXoCoY5qtwW1q6I=
 k8s.io/apiextensions-apiserver v0.16.4/go.mod h1:HYQwjujEkXmQNhap2C9YDdIVOSskGZ3et0Mvjcyjbto=
 k8s.io/apiextensions-apiserver v0.17.2/go.mod h1:4KdMpjkEjjDI2pPfBA15OscyNldHWdBCfsWMDWAmSTs=
@@ -2513,8 +2513,8 @@ k8s.io/apimachinery v0.17.6/go.mod h1:Lg8zZ5iC/O8UjCqW6DNhcQG2m4TdjF9kwG3891OWbb
 k8s.io/apimachinery v0.18.5/go.mod h1:OaXp26zu/5J7p0f92ASynJa1pZo06YlV9fG7BoWbCko=
 k8s.io/apimachinery v0.21.1/go.mod h1:jbreFvJo3ov9rj7eWT7+sYiRx+qZuCYXwWT1bcDswPY=
 k8s.io/apimachinery v0.32.2/go.mod h1:GpHVgxoKlTxClKcteaeuF1Ul/lDVb74KpZcxcmLDElE=
-k8s.io/apimachinery v0.33.0 h1:1a6kHrJxb2hs4t8EE5wuR/WxKDwGN1FKH3JvDtA0CIQ=
-k8s.io/apimachinery v0.33.0/go.mod h1:BHW0YOu7n22fFv/JkYOEfkUYNRN0fj0BlvMFWA7b+SM=
+k8s.io/apimachinery v0.33.1 h1:mzqXWV8tW9Rw4VeW9rEkqvnxj59k1ezDUl20tFK/oM4=
+k8s.io/apimachinery v0.33.1/go.mod h1:BHW0YOu7n22fFv/JkYOEfkUYNRN0fj0BlvMFWA7b+SM=
 k8s.io/apiserver v0.0.0-20190918200908-1e17798da8c1/go.mod h1:4FuDU+iKPjdsdQSN3GsEKZLB/feQsj1y9dhhBDVV2Ns=
 k8s.io/apiserver v0.16.4/go.mod h1:kbLJOak655g6W7C+muqu1F76u9wnEycfKMqbVaXIdAc=
 k8s.io/apiserver v0.17.0/go.mod h1:ABM+9x/prjINN6iiffRVNCBR2Wk7uY4z+EtEGZD48cg=
@@ -2528,8 +2528,8 @@ k8s.io/client-go v0.32.2 h1:4dYCD4Nz+9RApM2b/3BtVvBHw54QjMFUl1OLcJG5yOA=
 k8s.io/client-go v0.32.2/go.mod h1:fpZ4oJXclZ3r2nDOv+Ux3XcJutfrwjKTCHz2H3sww94=
 k8s.io/cloud-provider v0.17.0/go.mod h1:Ze4c3w2C0bRsjkBUoHpFi+qWe3ob1wI2/7cUn+YQIDE=
 k8s.io/cloud-provider v0.17.4/go.mod h1:XEjKDzfD+b9MTLXQFlDGkk6Ho8SGMpaU8Uugx/KNK9U=
-k8s.io/cloud-provider v0.33.0 h1:nVU2Q9QK7O50yaNx+pE61oDPqflsSsKygN43f5js9+I=
-k8s.io/cloud-provider v0.33.0/go.mod h1:2reyEBbsimZJKHF325vxLBD5fcJGNeJHeLjJ+jGM8Qg=
+k8s.io/cloud-provider v0.33.1 h1:nOmby9fIKCBJr9fNKXpLK5IBbS1snX82+JIxfxGvhI8=
+k8s.io/cloud-provider v0.33.1/go.mod h1:2lvWqPsvBOzbtGWjGfVDX/ttpvSeI9ZdB8d4TbYnt9s=
 k8s.io/code-generator v0.0.0-20190612205613-18da4a14b22b/go.mod h1:G8bQwmHm2eafm5bgtX67XDZQ8CWKSGu9DekI+yN4Y5I=
 k8s.io/code-generator v0.0.0-20190831074504-732c9ca86353/go.mod h1:V5BD6M4CyaN5m+VthcclXWsVcT1Hu+glwa1bi3MIsyE=
 k8s.io/code-generator v0.16.4/go.mod h1:mJUgkl06XV4kstAnLHAIzJPVCOzVR+ZcfPIv4fUsFCY=
@@ -2546,8 +2546,8 @@ k8s.io/component-base v0.17.2/go.mod h1:zMPW3g5aH7cHJpKYQ/ZsGMcgbsA/VyhEugF3QT1a
 k8s.io/component-base v0.17.4/go.mod h1:5BRqHMbbQPm2kKu35v3G+CpVq4K0RJKC7TRioF0I9lE=
 k8s.io/component-base v0.17.6/go.mod h1:jgRLWl0B0rOzFNtxQ9E4BphPmDqoMafujdau6AdG2Xo=
 k8s.io/component-base v0.21.1/go.mod h1:NgzFZ2qu4m1juby4TnrmpR8adRk6ka62YdH5DkIIyKA=
-k8s.io/component-base v0.33.0 h1:Ot4PyJI+0JAD9covDhwLp9UNkUja209OzsJ4FzScBNk=
-k8s.io/component-base v0.33.0/go.mod h1:aXYZLbw3kihdkOPMDhWbjGCO6sg+luw554KP51t8qCU=
+k8s.io/component-base v0.33.1 h1:EoJ0xA+wr77T+G8p6T3l4efT2oNwbqBVKR71E0tBIaI=
+k8s.io/component-base v0.33.1/go.mod h1:guT/w/6piyPfTgq7gfvgetyXMIh10zuXA6cRRm3rDuY=
 k8s.io/csi-translation-lib v0.17.0/go.mod h1:HEF7MEz7pOLJCnxabi45IPkhSsE/KmxPQksuCrHKWls=
 k8s.io/csi-translation-lib v0.17.4/go.mod h1:CsxmjwxEI0tTNMzffIAcgR9lX4wOh6AKHdxQrT7L0oo=
 k8s.io/gengo v0.0.0-20190116091435-f8a0810f38af/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0=
@@ -2591,8 +2591,8 @@ k8s.io/kubernetes v1.14.7/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk=
 k8s.io/legacy-cloud-providers v0.17.0/go.mod h1:DdzaepJ3RtRy+e5YhNtrCYwlgyK87j/5+Yfp0L9Syp8=
 k8s.io/legacy-cloud-providers v0.17.4/go.mod h1:FikRNoD64ECjkxO36gkDgJeiQWwyZTuBkhu+yxOc1Js=
 k8s.io/metrics v0.17.2/go.mod h1:3TkNHET4ROd+NfzNxkjoVfQ0Ob4iZnaHmSEA4vYpwLw=
-k8s.io/mount-utils v0.33.0 h1:hH6EcCcax4lFNIERaGMj6d7oGMW1qW3eTCwHUuLtLog=
-k8s.io/mount-utils v0.33.0/go.mod h1:1JR4rKymg8B8bCPo618hpSAdrpO6XLh0Acqok/xVwPE=
+k8s.io/mount-utils v0.33.1 h1:hodPhfyoK+gG0SgnYwx1iPrlnpaESZiJ9GFzF5V/imE=
+k8s.io/mount-utils v0.33.1/go.mod h1:1JR4rKymg8B8bCPo618hpSAdrpO6XLh0Acqok/xVwPE=
 k8s.io/test-infra v0.0.0-20181019233642-2e10a0bbe9b3/go.mod h1:2NzXB13Ji0nqpyublHeiPC4FZwU0TknfvyaaNfl/BTA=
 k8s.io/test-infra v0.0.0-20191212060232-70b0b49fe247/go.mod h1:d8SKryJBXAwfCFVL4wieRez47J2NOOAb9d029sWLseQ=
 k8s.io/test-infra v0.0.0-20200407001919-bc7f71ef65b8/go.mod h1:/WpJWcaDvuykB322WXP4kJbX8IpalOzuPxA62GpwkJk=
diff --git a/vendor/k8s.io/apimachinery/pkg/util/yaml/decoder.go b/vendor/k8s.io/apimachinery/pkg/util/yaml/decoder.go
index 7342f8d1..bd91a189 100644
--- a/vendor/k8s.io/apimachinery/pkg/util/yaml/decoder.go
+++ b/vendor/k8s.io/apimachinery/pkg/util/yaml/decoder.go
@@ -247,10 +247,12 @@ func splitYAMLDocument(data []byte, atEOF bool) (advance int, token []byte, err
 // finding a non-YAML-delimited series of objects), it will not switch to YAML.
 // Once it switches to YAML it will not switch back to JSON.
 type YAMLOrJSONDecoder struct {
-	json   *json.Decoder
-	yaml   *YAMLToJSONDecoder
-	stream *StreamReader
-	count  int // how many objects have been decoded
+	json         *json.Decoder
+	jsonConsumed int64 // of the stream total, how much was JSON?
+	yaml         *YAMLToJSONDecoder
+	yamlConsumed int64 // of the stream total, how much was YAML?
+	stream       *StreamReader
+	count        int // how many objects have been decoded
 }
 
 type JSONSyntaxError struct {
@@ -299,8 +301,10 @@ func (d *YAMLOrJSONDecoder) Decode(into interface{}) error {
 	if d.json != nil {
 		err := d.json.Decode(into)
 		if err == nil {
-			d.stream.Consume(int(d.json.InputOffset()) - d.stream.Consumed())
 			d.count++
+			consumed := d.json.InputOffset() - d.jsonConsumed
+			d.stream.Consume(int(consumed))
+			d.jsonConsumed += consumed
 			return nil
 		}
 		if err == io.EOF { //nolint:errorlint
@@ -334,7 +338,9 @@ func (d *YAMLOrJSONDecoder) Decode(into interface{}) error {
 	if d.yaml != nil {
 		err := d.yaml.Decode(into)
 		if err == nil {
-			d.stream.Consume(d.yaml.InputOffset() - d.stream.Consumed())
+			consumed := int64(d.yaml.InputOffset()) - d.yamlConsumed
+			d.stream.Consume(int(consumed))
+			d.yamlConsumed += consumed
 			d.count++
 			return nil
 		}
@@ -375,6 +381,7 @@ func (d *YAMLOrJSONDecoder) consumeWhitespace() error {
 		if err == io.EOF { //nolint:errorlint
 			break
 		}
+		consumed += sz
 	}
 	return io.EOF
 }
diff --git a/vendor/k8s.io/mount-utils/resizefs_linux.go b/vendor/k8s.io/mount-utils/resizefs_linux.go
index 3a5fa1be..3eaf46a4 100644
--- a/vendor/k8s.io/mount-utils/resizefs_linux.go
+++ b/vendor/k8s.io/mount-utils/resizefs_linux.go
@@ -117,11 +117,6 @@ func (resizefs *ResizeFs) NeedResize(devicePath string, deviceMountPath string)
 		return false, nil
 	}
 
-	deviceSize, err := resizefs.getDeviceSize(devicePath)
-	if err != nil {
-		return false, err
-	}
-	var fsSize, blockSize uint64
 	format, err := getDiskFormat(resizefs.exec, devicePath)
 	if err != nil {
 		formatErr := fmt.Errorf("ResizeFS.Resize - error checking format for device %s: %v", devicePath, err)
@@ -134,30 +129,28 @@ func (resizefs *ResizeFs) NeedResize(devicePath string, deviceMountPath string)
 		return false, nil
 	}
 
-	klog.V(3).Infof("ResizeFs.needResize - checking mounted volume %s", devicePath)
 	switch format {
-	case "ext3", "ext4":
-		blockSize, fsSize, err = resizefs.getExtSize(devicePath)
-		klog.V(5).Infof("Ext size: filesystem size=%d, block size=%d", fsSize, blockSize)
-	case "xfs":
-		blockSize, fsSize, err = resizefs.getXFSSize(deviceMountPath)
-		klog.V(5).Infof("Xfs size: filesystem size=%d, block size=%d, err=%v", fsSize, blockSize, err)
+	case "ext3", "ext4", "xfs":
+		// For ext3/ext4/xfs, recommendation received from linux filesystem folks is to let
+		// resize2fs/xfs_growfs do the check for us. So we will not do any check here.
+		return true, nil
 	case "btrfs":
-		blockSize, fsSize, err = resizefs.getBtrfsSize(devicePath)
+		deviceSize, err := resizefs.getDeviceSize(devicePath)
+		if err != nil {
+			return false, err
+		}
+		blockSize, fsSize, err := resizefs.getBtrfsSize(devicePath)
 		klog.V(5).Infof("Btrfs size: filesystem size=%d, block size=%d, err=%v", fsSize, blockSize, err)
+		if err != nil {
+			return false, err
+		}
+		if deviceSize <= fsSize+blockSize {
+			return false, nil
+		}
+		return true, nil
 	default:
-		klog.Errorf("Not able to parse given filesystem info. fsType: %s, will not resize", format)
-		return false, fmt.Errorf("Could not parse fs info on given filesystem format: %s. Supported fs types are: xfs, ext3, ext4", format)
+		return false, fmt.Errorf("could not parse fs info of given filesystem format: %s. Supported fs types are: xfs, ext3, ext4", format)
 	}
-	if err != nil {
-		return false, err
-	}
-	// Tolerate one block difference, just in case of rounding errors somewhere.
-	klog.V(5).Infof("Volume %s: device size=%d, filesystem size=%d, block size=%d", devicePath, deviceSize, fsSize, blockSize)
-	if deviceSize <= fsSize+blockSize {
-		return false, nil
-	}
-	return true, nil
 }
 
 func (resizefs *ResizeFs) getDeviceSize(devicePath string) (uint64, error) {
@@ -173,56 +166,6 @@ func (resizefs *ResizeFs) getDeviceSize(devicePath string) (uint64, error) {
 	return size, nil
 }
 
-func (resizefs *ResizeFs) getDeviceRO(devicePath string) (bool, error) {
-	output, err := resizefs.exec.Command(blockDev, "--getro", devicePath).CombinedOutput()
-	outStr := strings.TrimSpace(string(output))
-	if err != nil {
-		return false, fmt.Errorf("failed to get readonly bit from device %s: %s: %s", devicePath, err, outStr)
-	}
-	switch outStr {
-	case "0":
-		return false, nil
-	case "1":
-		return true, nil
-	default:
-		return false, fmt.Errorf("Failed readonly device check. Expected 1 or 0, got '%s'", outStr)
-	}
-}
-
-func (resizefs *ResizeFs) getExtSize(devicePath string) (uint64, uint64, error) {
-	output, err := resizefs.exec.Command("dumpe2fs", "-h", devicePath).CombinedOutput()
-	if err != nil {
-		return 0, 0, fmt.Errorf("failed to read size of filesystem on %s: %s: %s", devicePath, err, string(output))
-	}
-
-	blockSize, blockCount, _ := resizefs.parseFsInfoOutput(string(output), ":", "block size", "block count")
-
-	if blockSize == 0 {
-		return 0, 0, fmt.Errorf("could not find block size of device %s", devicePath)
-	}
-	if blockCount == 0 {
-		return 0, 0, fmt.Errorf("could not find block count of device %s", devicePath)
-	}
-	return blockSize, blockSize * blockCount, nil
-}
-
-func (resizefs *ResizeFs) getXFSSize(devicePath string) (uint64, uint64, error) {
-	output, err := resizefs.exec.Command("xfs_io", "-c", "statfs", devicePath).CombinedOutput()
-	if err != nil {
-		return 0, 0, fmt.Errorf("failed to read size of filesystem on %s: %s: %s", devicePath, err, string(output))
-	}
-
-	blockSize, blockCount, _ := resizefs.parseFsInfoOutput(string(output), "=", "geom.bsize", "geom.datablocks")
-
-	if blockSize == 0 {
-		return 0, 0, fmt.Errorf("could not find block size of device %s", devicePath)
-	}
-	if blockCount == 0 {
-		return 0, 0, fmt.Errorf("could not find block count of device %s", devicePath)
-	}
-	return blockSize, blockSize * blockCount, nil
-}
-
 func (resizefs *ResizeFs) getBtrfsSize(devicePath string) (uint64, uint64, error) {
 	output, err := resizefs.exec.Command("btrfs", "inspect-internal", "dump-super", "-f", devicePath).CombinedOutput()
 	if err != nil {
@@ -268,29 +211,18 @@ func (resizefs *ResizeFs) parseBtrfsInfoOutput(cmdOutput string, blockSizeKey st
 	return blockSize, blockCount, err
 }
 
-func (resizefs *ResizeFs) parseFsInfoOutput(cmdOutput string, spliter string, blockSizeKey string, blockCountKey string) (uint64, uint64, error) {
-	lines := strings.Split(cmdOutput, "\n")
-	var blockSize, blockCount uint64
-	var err error
-
-	for _, line := range lines {
-		tokens := strings.Split(line, spliter)
-		if len(tokens) != 2 {
-			continue
-		}
-		key, value := strings.ToLower(strings.TrimSpace(tokens[0])), strings.ToLower(strings.TrimSpace(tokens[1]))
-		if key == blockSizeKey {
-			blockSize, err = strconv.ParseUint(value, 10, 64)
-			if err != nil {
-				return 0, 0, fmt.Errorf("failed to parse block size %s: %s", value, err)
-			}
-		}
-		if key == blockCountKey {
-			blockCount, err = strconv.ParseUint(value, 10, 64)
-			if err != nil {
-				return 0, 0, fmt.Errorf("failed to parse block count %s: %s", value, err)
-			}
-		}
+func (resizefs *ResizeFs) getDeviceRO(devicePath string) (bool, error) {
+	output, err := resizefs.exec.Command(blockDev, "--getro", devicePath).CombinedOutput()
+	outStr := strings.TrimSpace(string(output))
+	if err != nil {
+		return false, fmt.Errorf("failed to get readonly bit from device %s: %w: %s", devicePath, err, outStr)
+	}
+	switch outStr {
+	case "0":
+		return false, nil
+	case "1":
+		return true, nil
+	default:
+		return false, fmt.Errorf("failed readonly device check. Expected 1 or 0, got '%s'", outStr)
 	}
-	return blockSize, blockCount, err
 }
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 46769c08..15146116 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -641,7 +641,7 @@ gopkg.in/yaml.v2
 # gopkg.in/yaml.v3 v3.0.1
 ## explicit
 gopkg.in/yaml.v3
-# k8s.io/api v0.33.0
+# k8s.io/api v0.33.1
 ## explicit; go 1.24.0
 k8s.io/api/admissionregistration/v1
 k8s.io/api/admissionregistration/v1alpha1
@@ -699,7 +699,7 @@ k8s.io/api/storage/v1
 k8s.io/api/storage/v1alpha1
 k8s.io/api/storage/v1beta1
 k8s.io/api/storagemigration/v1alpha1
-# k8s.io/apimachinery v0.33.0
+# k8s.io/apimachinery v0.33.1
 ## explicit; go 1.24.0
 k8s.io/apimachinery/pkg/api/equality
 k8s.io/apimachinery/pkg/api/errors
@@ -894,11 +894,11 @@ k8s.io/client-go/util/homedir
 k8s.io/client-go/util/keyutil
 k8s.io/client-go/util/watchlist
 k8s.io/client-go/util/workqueue
-# k8s.io/cloud-provider v0.33.0
+# k8s.io/cloud-provider v0.33.1
 ## explicit; go 1.24.0
 k8s.io/cloud-provider/volume
 k8s.io/cloud-provider/volume/helpers
-# k8s.io/component-base v0.33.0
+# k8s.io/component-base v0.33.1
 ## explicit; go 1.24.0
 k8s.io/component-base/metrics
 k8s.io/component-base/metrics/prometheusextension
@@ -923,7 +923,7 @@ k8s.io/kube-openapi/pkg/schemaconv
 k8s.io/kube-openapi/pkg/spec3
 k8s.io/kube-openapi/pkg/util/proto
 k8s.io/kube-openapi/pkg/validation/spec
-# k8s.io/mount-utils v0.33.0
+# k8s.io/mount-utils v0.33.1
 ## explicit; go 1.24.0
 k8s.io/mount-utils
 # k8s.io/test-infra v0.0.0-20210730160938-8ad9b8c53bd8


Test patch:
diff --git a/pkg/gce-pd-csi-driver/controller_test.go b/pkg/gce-pd-csi-driver/controller_test.go
index 34d8c2de..a70babeb 100644
--- a/pkg/gce-pd-csi-driver/controller_test.go
+++ b/pkg/gce-pd-csi-driver/controller_test.go
@@ -41,7 +41,6 @@ import (
 	"k8s.io/client-go/util/flowcontrol"
 	"k8s.io/klog/v2"
 	clock "k8s.io/utils/clock/testing"
-	"k8s.io/utils/strings/slices"
 
 	csi "github.com/container-storage-interface/spec/lib/go/csi"
 	"sigs.k8s.io/gcp-compute-persistent-disk-csi-driver/pkg/common"
@@ -5016,7 +5015,7 @@ func TestPickZonesFromTopology(t *testing.T) {
 		if err == nil && tc.expErr {
 			t.Errorf("got no error, but expected error")
 		}
-		if !slices.Equal(gotZones, tc.expZones) {
+		if !zonesEqual(gotZones, tc.expZones) {
 			t.Errorf("Expected zones: %v, but got: %v", tc.expZones, gotZones)
 		}
 	}
@@ -5026,8 +5025,12 @@ func zonesEqual(gotZones, expectedZones []string) bool {
 	if len(gotZones) != len(expectedZones) {
 		return false
 	}
-	for i := 0; i < len(gotZones); i++ {
-		if gotZones[i] != expectedZones[i] {
+	gotSet := make(map[string]bool)
+	for _, zone := range gotZones {
+		gotSet[zone] = true
+	}
+	for _, zone := range expectedZones {
+		if !gotSet[zone] {
 			return false
 		}
 	}
diff --git a/pkg/gce-pd-csi-driver/node_test.go b/pkg/gce-pd-csi-driver/node_test.go
index 058cd4f0..34519105 100644
--- a/pkg/gce-pd-csi-driver/node_test.go
+++ b/pkg/gce-pd-csi-driver/node_test.go
@@ -496,6 +496,13 @@ func TestNodeUnpublishVolume(t *testing.T) {
 	}
 }
 
+type fakeCmd struct {
+	cmd    string
+	args   string
+	stdout string
+	err    error
+}
+
 func TestNodeStageVolume(t *testing.T) {
 	volumeID := "project/test001/zones/c1/disks/testDisk"
 	blockCap := &csi.VolumeCapability_Block{
@@ -535,6 +542,8 @@ func TestNodeStageVolume(t *testing.T) {
 		expResize            bool
 		expReadAheadUpdate   bool
 		expReadAheadKB       string
+		expReadOnlyRemount   bool
+		expCommandList       []fakeCmd
 		readAheadSectors     string
 		btrfsReclaimData     string
 		btrfsReclaimMetadata string
@@ -542,7 +551,7 @@ func TestNodeStageVolume(t *testing.T) {
 		expErrCode           codes.Code
 	}{
 		{
-			name: "Valid request, no resize because block and filesystem sizes match",
+			name: "Valid request, resize even though block and filesystem sizes match",
 			req: &csi.NodeStageVolumeRequest{
 				VolumeId:          volumeID,
 				StagingTargetPath: stagingPath,
@@ -551,7 +560,39 @@ func TestNodeStageVolume(t *testing.T) {
 			deviceSize:   1,
 			blockExtSize: 1,
 			readonlyBit:  "0",
-			expResize:    false,
+			expResize:    true,
+			expCommandList: []fakeCmd{
+				{
+					cmd:    "blkid",
+					args:   "-p -s TYPE -s PTTYPE -o export /dev/disk/fake-path",
+					stdout: "DEVNAME=/dev/sdb\nTYPE=%v",
+				},
+				{
+					cmd:    "fsck",
+					args:   "-a /dev/disk/fake-path",
+					stdout: "",
+				},
+				{
+					cmd:    "blockdev",
+					args:   "--getro /dev/disk/fake-path",
+					stdout: "%v",
+				},
+				{
+					cmd:    "blkid",
+					args:   "-p -s TYPE -s PTTYPE -o export /dev/disk/fake-path",
+					stdout: "DEVNAME=/dev/sdb\nTYPE=%v",
+				},
+				{
+					cmd:    "blkid",
+					args:   "-p -s TYPE -s PTTYPE -o export /dev/disk/fake-path",
+					stdout: "DEVNAME=/dev/sdb\nTYPE=%v",
+				},
+				{
+					cmd:    "resize2fs",
+					args:   "/dev/disk/fake-path",
+					stdout: "",
+				},
+			},
 		},
 		{
 			name: "Valid request, no resize bc readonly",
@@ -564,6 +605,23 @@ func TestNodeStageVolume(t *testing.T) {
 			blockExtSize: 1,
 			readonlyBit:  "1",
 			expResize:    false,
+			expCommandList: []fakeCmd{
+				{
+					cmd:    "blkid",
+					args:   "-p -s TYPE -s PTTYPE -o export /dev/disk/fake-path",
+					stdout: "DEVNAME=/dev/sdb\nTYPE=%v",
+				},
+				{
+					cmd:    "fsck",
+					args:   "-a /dev/disk/fake-path",
+					stdout: "",
+				},
+				{
+					cmd:    "blockdev",
+					args:   "--getro /dev/disk/fake-path",
+					stdout: "%v",
+				},
+			},
 		},
 		{
 			name: "Valid request, resize bc size",
@@ -576,6 +634,38 @@ func TestNodeStageVolume(t *testing.T) {
 			blockExtSize: 1,
 			readonlyBit:  "0",
 			expResize:    true,
+			expCommandList: []fakeCmd{
+				{
+					cmd:    "blkid",
+					args:   "-p -s TYPE -s PTTYPE -o export /dev/disk/fake-path",
+					stdout: "DEVNAME=/dev/sdb\nTYPE=%v",
+				},
+				{
+					cmd:    "fsck",
+					args:   "-a /dev/disk/fake-path",
+					stdout: "",
+				},
+				{
+					cmd:    "blockdev",
+					args:   "--getro /dev/disk/fake-path",
+					stdout: "%v",
+				},
+				{
+					cmd:    "blkid",
+					args:   "-p -s TYPE -s PTTYPE -o export /dev/disk/fake-path",
+					stdout: "DEVNAME=/dev/sdb\nTYPE=%v",
+				},
+				{
+					cmd:    "blkid",
+					args:   "-p -s TYPE -s PTTYPE -o export /dev/disk/fake-path",
+					stdout: "DEVNAME=/dev/sdb\nTYPE=%v",
+				},
+				{
+					cmd:    "resize2fs",
+					args:   "/dev/disk/fake-path",
+					stdout: "",
+				},
+			},
 		},
 		{
 			name: "Valid request, no resize bc readonly capability",
@@ -588,6 +678,13 @@ func TestNodeStageVolume(t *testing.T) {
 			blockExtSize: 1,
 			readonlyBit:  "0",
 			expResize:    false,
+			expCommandList: []fakeCmd{
+				{
+					cmd:    "blkid",
+					args:   "-p -s TYPE -s PTTYPE -o export /dev/disk/fake-path",
+					stdout: "DEVNAME=/dev/sdb\nTYPE=%v",
+				},
+			},
 		},
 		{
 			name: "btrfs-allocation-data-bg_reclaim_threshold is ignored on non-btrfs",
@@ -610,6 +707,39 @@ func TestNodeStageVolume(t *testing.T) {
 			blockExtSize:     1,
 			readonlyBit:      "0",
 			btrfsReclaimData: "0",
+			expResize:        true,
+			expCommandList: []fakeCmd{
+				{
+					cmd:    "blkid",
+					args:   "-p -s TYPE -s PTTYPE -o export /dev/disk/fake-path",
+					stdout: "DEVNAME=/dev/sdb\nTYPE=%v",
+				},
+				{
+					cmd:    "fsck",
+					args:   "-a /dev/disk/fake-path",
+					stdout: "",
+				},
+				{
+					cmd:    "blockdev",
+					args:   "--getro /dev/disk/fake-path",
+					stdout: "%v",
+				},
+				{
+					cmd:    "blkid",
+					args:   "-p -s TYPE -s PTTYPE -o export /dev/disk/fake-path",
+					stdout: "DEVNAME=/dev/sdb\nTYPE=%v",
+				},
+				{
+					cmd:    "blkid",
+					args:   "-p -s TYPE -s PTTYPE -o export /dev/disk/fake-path",
+					stdout: "DEVNAME=/dev/sdb\nTYPE=%v",
+				},
+				{
+					cmd:    "resize2fs",
+					args:   "/dev/disk/fake-path",
+					stdout: "",
+				},
+			},
 		},
 		{
 			name: "Valid request, set btrfs-allocation-data-bg_reclaim_threshold=90",
@@ -632,6 +762,43 @@ func TestNodeStageVolume(t *testing.T) {
 			blockExtSize:     1,
 			readonlyBit:      "0",
 			btrfsReclaimData: "90",
+			expCommandList: []fakeCmd{
+				{
+					cmd:    "blkid",
+					args:   "-p -s TYPE -s PTTYPE -o export /dev/disk/fake-path",
+					stdout: "DEVNAME=/dev/sdb\nTYPE=%v",
+				},
+				{
+					cmd:    "fsck",
+					args:   "-a /dev/disk/fake-path",
+					stdout: "",
+				},
+				{
+					cmd:    "blockdev",
+					args:   "--getro /dev/disk/fake-path",
+					stdout: "%v",
+				},
+				{
+					cmd:    "blkid",
+					args:   "-p -s TYPE -s PTTYPE -o export /dev/disk/fake-path",
+					stdout: "DEVNAME=/dev/sdb\nTYPE=%v",
+				},
+				{
+					cmd:    "blockdev",
+					args:   "--getsize64 /dev/disk/fake-path",
+					stdout: "%d",
+				},
+				{
+					cmd:    "btrfs",
+					args:   "inspect-internal dump-super -f /dev/disk/fake-path",
+					stdout: "sectorsize %d\ntotal_bytes %d",
+				},
+				{
+					cmd:    "blkid",
+					args:   fmt.Sprintf("--match-tag UUID --output value %v", stagingPath),
+					stdout: btrfsUUID + "\n",
+				},
+			},
 		},
 		{
 			name: "Valid request, set btrfs-allocation-{,meta}data-bg_reclaim_threshold",
@@ -658,6 +825,43 @@ func TestNodeStageVolume(t *testing.T) {
 			readonlyBit:          "0",
 			btrfsReclaimData:     "90",
 			btrfsReclaimMetadata: "91",
+			expCommandList: []fakeCmd{
+				{
+					cmd:    "blkid",
+					args:   "-p -s TYPE -s PTTYPE -o export /dev/disk/fake-path",
+					stdout: "DEVNAME=/dev/sdb\nTYPE=%v",
+				},
+				{
+					cmd:    "fsck",
+					args:   "-a /dev/disk/fake-path",
+					stdout: "",
+				},
+				{
+					cmd:    "blockdev",
+					args:   "--getro /dev/disk/fake-path",
+					stdout: "%v",
+				},
+				{
+					cmd:    "blkid",
+					args:   "-p -s TYPE -s PTTYPE -o export /dev/disk/fake-path",
+					stdout: "DEVNAME=/dev/sdb\nTYPE=%v",
+				},
+				{
+					cmd:    "blockdev",
+					args:   "--getsize64 /dev/disk/fake-path",
+					stdout: "%d",
+				},
+				{
+					cmd:    "btrfs",
+					args:   "inspect-internal dump-super -f /dev/disk/fake-path",
+					stdout: "sectorsize %d\ntotal_bytes %d",
+				},
+				{
+					cmd:    "blkid",
+					args:   fmt.Sprintf("--match-tag UUID --output value %v", stagingPath),
+					stdout: btrfsUUID + "\n",
+				},
+			},
 		},
 		{
 			name: "Valid request, update readahead",
@@ -682,6 +886,47 @@ func TestNodeStageVolume(t *testing.T) {
 			expReadAheadUpdate: true,
 			readAheadSectors:   "8192",
 			sectorSizeInBytes:  512,
+			expCommandList: []fakeCmd{
+				{
+					cmd:    "blkid",
+					args:   "-p -s TYPE -s PTTYPE -o export /dev/disk/fake-path",
+					stdout: "DEVNAME=/dev/sdb\nTYPE=%v",
+				},
+				{
+					cmd:    "fsck",
+					args:   "-a /dev/disk/fake-path",
+					stdout: "",
+				},
+				{
+					cmd:    "blockdev",
+					args:   "--getro /dev/disk/fake-path",
+					stdout: "%v",
+				},
+				{
+					cmd:    "blkid",
+					args:   "-p -s TYPE -s PTTYPE -o export /dev/disk/fake-path",
+					stdout: "DEVNAME=/dev/sdb\nTYPE=%v",
+				},
+				{
+					cmd:    "blkid",
+					args:   "-p -s TYPE -s PTTYPE -o export /dev/disk/fake-path",
+					stdout: "DEVNAME=/dev/sdb\nTYPE=%v",
+				},
+				{
+					cmd:    "resize2fs",
+					args:   "/dev/disk/fake-path",
+					stdout: "",
+				},
+				{
+					cmd:    "blockdev",
+					args:   "--getss /dev/disk/fake-path",
+					stdout: "%d",
+				},
+				{
+					cmd:  "blockdev",
+					args: "--setra %v /dev/disk/fake-path",
+				},
+			},
 		},
 		{
 			name: "Valid request, update readahead (different sectorsize)",
@@ -706,6 +951,47 @@ func TestNodeStageVolume(t *testing.T) {
 			expReadAheadUpdate: true,
 			readAheadSectors:   "4194304",
 			sectorSizeInBytes:  1,
+			expCommandList: []fakeCmd{
+				{
+					cmd:    "blkid",
+					args:   "-p -s TYPE -s PTTYPE -o export /dev/disk/fake-path",
+					stdout: "DEVNAME=/dev/sdb\nTYPE=%v",
+				},
+				{
+					cmd:    "fsck",
+					args:   "-a /dev/disk/fake-path",
+					stdout: "",
+				},
+				{
+					cmd:    "blockdev",
+					args:   "--getro /dev/disk/fake-path",
+					stdout: "%v",
+				},
+				{
+					cmd:    "blkid",
+					args:   "-p -s TYPE -s PTTYPE -o export /dev/disk/fake-path",
+					stdout: "DEVNAME=/dev/sdb\nTYPE=%v",
+				},
+				{
+					cmd:    "blkid",
+					args:   "-p -s TYPE -s PTTYPE -o export /dev/disk/fake-path",
+					stdout: "DEVNAME=/dev/sdb\nTYPE=%v",
+				},
+				{
+					cmd:    "resize2fs",
+					args:   "/dev/disk/fake-path",
+					stdout: "",
+				},
+				{
+					cmd:    "blockdev",
+					args:   "--getss /dev/disk/fake-path",
+					stdout: "%d",
+				},
+				{
+					cmd:  "blockdev",
+					args: "--setra %v /dev/disk/fake-path",
+				},
+			},
 		},
 		{
 			name: "Invalid request (Bad Access Mode)",
@@ -788,203 +1074,107 @@ func TestNodeStageVolume(t *testing.T) {
 		},
 	}
 	for _, tc := range testCases {
-		t.Logf("Test case: %s", tc.name)
-		resizeCalled := false
-		readAheadUpdateCalled := false
-		blkidCalled := false
-		actionList := []testingexec.FakeCommandAction{
-			makeFakeCmd(
-				&testingexec.FakeCmd{
-					CombinedOutputScript: []testingexec.FakeAction{
-						func() ([]byte, []byte, error) {
-							return []byte(fmt.Sprintf("DEVNAME=/dev/sdb\nTYPE=ext4")), nil, nil
-						},
-					},
-				},
-				"blkid",
-				strings.Split("-p -s TYPE -s PTTYPE -o export /dev/disk/fake-path", " ")...,
-			),
-			makeFakeCmd(
-				&testingexec.FakeCmd{
-					CombinedOutputScript: []testingexec.FakeAction{
-						func() ([]byte, []byte, error) {
-							return []byte(""), nil, nil
-						},
-					},
-				},
-				"fsck",
-				strings.Split("-a /dev/disk/fake-path", " ")...,
-			),
-			makeFakeCmd(
-				&testingexec.FakeCmd{
-					CombinedOutputScript: []testingexec.FakeAction{
-						func() ([]byte, []byte, error) {
-							return []byte(tc.readonlyBit), nil, nil
-						},
-					},
-				},
-				"blockdev",
-				strings.Split("--getro /dev/disk/fake-path", " ")...,
-			),
-			makeFakeCmd(
-				&testingexec.FakeCmd{
-					CombinedOutputScript: []testingexec.FakeAction{
-						func() ([]byte, []byte, error) {
-							return []byte(fmt.Sprintf("%d", tc.deviceSize)), nil, nil
-						},
-					},
-				},
-				"blockdev",
-				strings.Split("--getsize64 /dev/disk/fake-path", " ")...,
-			),
-			makeFakeCmd(
-				&testingexec.FakeCmd{
-					CombinedOutputScript: []testingexec.FakeAction{
-						func() ([]byte, []byte, error) {
-							return []byte(fmt.Sprintf("DEVNAME=/dev/sdb\nTYPE=ext4")), nil, nil
-						},
-					},
-				},
-				"blkid",
-				strings.Split("-p -s TYPE -s PTTYPE -o export /dev/disk/fake-path", " ")...,
-			),
-			makeFakeCmd(
-				&testingexec.FakeCmd{
-					CombinedOutputScript: []testingexec.FakeAction{
-						func() ([]byte, []byte, error) {
-							return []byte(fmt.Sprintf("block size: %d\nblock count: 1", tc.blockExtSize)), nil, nil
-						},
-					},
-				},
-				"dumpe2fs",
-				strings.Split("-h /dev/disk/fake-path", " ")...,
-			),
-		}
-
-		if tc.expResize {
-			actionList = append(actionList, []testingexec.FakeCommandAction{
-				makeFakeCmd(
-					&testingexec.FakeCmd{
-						CombinedOutputScript: []testingexec.FakeAction{
-							func() ([]byte, []byte, error) {
-								return []byte(fmt.Sprintf("DEVNAME=/dev/sdb\nTYPE=ext4")), nil, nil
-							},
-						},
-					},
-					"blkid",
-					strings.Split("-p -s TYPE -s PTTYPE -o export /dev/disk/fake-path", " ")...,
-				),
-				makeFakeCmd(
-					&testingexec.FakeCmd{
-						CombinedOutputScript: []testingexec.FakeAction{
-							func() ([]byte, []byte, error) {
-								resizeCalled = true
-								return []byte(fmt.Sprintf("DEVNAME=/dev/sdb\nTYPE=ext4")), nil, nil
-							},
-						},
-					},
-					"resize2fs",
-					strings.Split("/dev/disk/fake-path", " ")...,
-				),
-			}...)
-		}
-		if tc.expReadAheadUpdate {
-			actionList = append(actionList, []testingexec.FakeCommandAction{
-				makeFakeCmd(
-					&testingexec.FakeCmd{
-						CombinedOutputScript: []testingexec.FakeAction{
-							func() ([]byte, []byte, error) {
-								return []byte(fmt.Sprintf("%d", tc.sectorSizeInBytes)), nil, nil
-							},
-						},
-					},
-					"blockdev",
-					[]string{"--getss", "/dev/disk/fake-path"}...,
-				),
-				makeFakeCmd(
-					&testingexec.FakeCmd{
-						CombinedOutputScript: []testingexec.FakeAction{
-							func() (_ []byte, args []byte, _ error) {
-								readAheadUpdateCalled = true
-								return []byte{}, nil, nil
-							},
-						},
+		t.Run(tc.name, func(t *testing.T) {
+			resizeCalled := false
+			readAheadUpdateCalled := false
+			blkidCalled := false
+			fsType := tc.req.GetVolumeCapability().GetMount().GetFsType()
+			if fsType == "" {
+				fsType = "ext4"
+			}
+			actionList := []testingexec.FakeCommandAction{}
+			for _, cmd := range tc.expCommandList {
+				t.Logf("cmd: %+v", cmd)
+				switch cmd.cmd {
+				case "resize2fs":
+					resizeCalled = true
+				case "blockdev":
+					if strings.Contains(cmd.args, "--getro") {
+						cmd.stdout = fmt.Sprintf(cmd.stdout, tc.readonlyBit)
+					} else if strings.Contains(cmd.args, "--getsize64") {
+						cmd.stdout = fmt.Sprintf(cmd.stdout, tc.deviceSize)
+					} else if strings.Contains(cmd.args, "--getss") {
+						cmd.stdout = fmt.Sprintf(cmd.stdout, tc.sectorSizeInBytes)
+					} else if strings.Contains(cmd.args, "--setra") {
+						readAheadUpdateCalled = true
+						cmd.args = fmt.Sprintf(cmd.args, tc.readAheadSectors)
+					}
+				case "blkid":
+					if strings.Contains(cmd.args, "TYPE") {
+						cmd.stdout = fmt.Sprintf(cmd.stdout, fsType)
+					}
+				case "btrfs":
+					cmd.stdout = fmt.Sprintf(cmd.stdout, tc.blockExtSize, tc.deviceSize)
+				}
+				action := []testingexec.FakeAction{
+					func() ([]byte, []byte, error) {
+						return []byte(cmd.stdout), nil, cmd.err
 					},
-					"blockdev",
-					[]string{"--setra", tc.readAheadSectors, "/dev/disk/fake-path"}...,
-				),
-			}...)
-		}
-		if tc.btrfsReclaimData != "" || tc.btrfsReclaimMetadata != "" {
-			actionList = append(actionList, []testingexec.FakeCommandAction{
-				makeFakeCmd(
+				}
+				actionList = append(actionList, makeFakeCmd(
 					&testingexec.FakeCmd{
-						OutputScript: []testingexec.FakeAction{
-							func() ([]byte, []byte, error) {
-								blkidCalled = true
-								return []byte(btrfsUUID + "\n"), nil, nil
-							},
-						},
+						CombinedOutputScript: action,
+						OutputScript:         action,
 					},
-					"blkid",
-					[]string{"--match-tag", "UUID", "--output", "value", stagingPath}...,
-				),
-			}...)
-		}
-		mounter := mountmanager.NewFakeSafeMounterWithCustomExec(&testingexec.FakeExec{CommandScript: actionList})
-		gceDriver := getTestGCEDriverWithCustomMounter(t, mounter)
-		ns := gceDriver.ns
-		ns.SysfsPath = tempDir + "/sys"
-		_, err := ns.NodeStageVolume(context.Background(), tc.req)
-		if err != nil {
-			serverError, ok := status.FromError(err)
-			if !ok {
-				t.Fatalf("Could not get error status code from err: %v", err)
+					cmd.cmd,
+					strings.Split(cmd.args, " ")...,
+				))
 			}
-			if serverError.Code() != tc.expErrCode {
-				t.Fatalf("Expected error code: %v, got: %v. err : %v", tc.expErrCode, serverError.Code(), err)
-			}
-			continue
-		}
-		if tc.expErrCode != codes.OK {
-			t.Fatalf("Expected error: %v, got no error", tc.expErrCode)
-		}
-		if tc.expResize == true && resizeCalled == false {
-			t.Fatalf("Test did not call resize, but it was expected.")
-		}
-		if tc.expResize == false && resizeCalled == true {
-			t.Fatalf("Test called resize, but it was not expected.")
-		}
-		if tc.expReadAheadUpdate == true && readAheadUpdateCalled == false {
-			t.Fatalf("Test did not update read ahead, but it was expected.")
-		}
-		if tc.expReadAheadUpdate == false && readAheadUpdateCalled == true {
-			t.Fatalf("Test updated read ahead, but it was not expected.")
-		}
-		if tc.btrfsReclaimData == "" && tc.btrfsReclaimMetadata == "" && blkidCalled {
-			t.Fatalf("blkid was called, but was not expected.")
-		}
-
-		if tc.btrfsReclaimData != "" {
-			fname := btrfsPrefix + "/data/bg_reclaim_threshold"
-			got, err := os.ReadFile(fname)
+			mounter := mountmanager.NewFakeSafeMounterWithCustomExec(&testingexec.FakeExec{CommandScript: actionList, ExactOrder: true})
+			gceDriver := getTestGCEDriverWithCustomMounter(t, mounter)
+			ns := gceDriver.ns
+			ns.SysfsPath = tempDir + "/sys"
+			_, err := ns.NodeStageVolume(context.Background(), tc.req)
 			if err != nil {
-				t.Fatalf("read %q: %v", fname, err)
+				serverError, ok := status.FromError(err)
+				if !ok {
+					t.Fatalf("Could not get error status code from err: %v", err)
+				}
+				if serverError.Code() != tc.expErrCode {
+					t.Fatalf("Expected error code: %v, got: %v. err : %v", tc.expErrCode, serverError.Code(), err)
+				}
+				return
 			}
-			if s := strings.TrimSpace(string(got)); s != tc.btrfsReclaimData {
-				t.Fatalf("%q: expected %q, got %q", fname, tc.btrfsReclaimData, s)
+			if tc.expErrCode != codes.OK {
+				t.Fatalf("Expected error: %v, got no error", tc.expErrCode)
 			}
-		}
-		if tc.btrfsReclaimMetadata != "" {
-			fname := btrfsPrefix + "/metadata/bg_reclaim_threshold"
-			got, err := os.ReadFile(fname)
-			if err != nil {
-				t.Fatalf("read %q: %v", fname, err)
+			if tc.expResize == true && resizeCalled == false {
+				t.Fatalf("Test did not call resize, but it was expected.")
 			}
-			if s := strings.TrimSpace(string(got)); s != tc.btrfsReclaimMetadata {
-				t.Fatalf("%q: expected %q, got %q", fname, tc.btrfsReclaimMetadata, s)
+			if tc.expResize == false && resizeCalled == true {
+				t.Fatalf("Test called resize, but it was not expected.")
 			}
-		}
+			if tc.expReadAheadUpdate == true && readAheadUpdateCalled == false {
+				t.Fatalf("Test did not update read ahead, but it was expected.")
+			}
+			if tc.expReadAheadUpdate == false && readAheadUpdateCalled == true {
+				t.Fatalf("Test updated read ahead, but it was not expected.")
+			}
+			if tc.btrfsReclaimData == "" && tc.btrfsReclaimMetadata == "" && blkidCalled {
+				t.Fatalf("blkid was called, but was not expected.")
+			}
+
+			if tc.btrfsReclaimData != "" {
+				fname := btrfsPrefix + "/data/bg_reclaim_threshold"
+				got, err := os.ReadFile(fname)
+				if err != nil {
+					t.Fatalf("read %q: %v", fname, err)
+				}
+				if s := strings.TrimSpace(string(got)); s != tc.btrfsReclaimData {
+					t.Fatalf("%q: expected %q, got %q", fname, tc.btrfsReclaimData, s)
+				}
+			}
+			if tc.btrfsReclaimMetadata != "" {
+				fname := btrfsPrefix + "/metadata/bg_reclaim_threshold"
+				got, err := os.ReadFile(fname)
+				if err != nil {
+					t.Fatalf("read %q: %v", fname, err)
+				}
+				if s := strings.TrimSpace(string(got)); s != tc.btrfsReclaimMetadata {
+					t.Fatalf("%q: expected %q, got %q", fname, tc.btrfsReclaimMetadata, s)
+				}
+			}
+		})
 	}
 }