{"record":{"id":"a519e4fd87fadba5","repo":"hashicorp/nomad","slug":"can-not-update-mount-options-while-volume-is-in-us","errorCode":null,"errorMessage":"can not update mount options while volume is in use","messagePattern":"can not update mount options while volume is in use","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/structs/csi.go","lineNumber":842,"sourceCode":"\t\t\t\t\"volume requested capabilities update was not compatible with existing capability in use\"))\n\t\t}\n\t} else {\n\t\tv.RequestedCapabilities = other.RequestedCapabilities\n\t}\n\n\t// topologies are immutable, so topology request changes must be\n\t// compatible with the existing topology, if any\n\tif len(v.Topologies) > 0 {\n\t\tif !v.RequestedTopologies.Equal(other.RequestedTopologies) {\n\t\t\terrs = multierror.Append(errs, errors.New(\n\t\t\t\t\"volume topology request update was not compatible with existing topology\"))\n\t\t}\n\t}\n\n\t// MountOptions can be updated so long as the volume isn't in use\n\tif v.InUse() {\n\t\tif !v.MountOptions.Equal(other.MountOptions) {\n\t\t\terrs = multierror.Append(errs, errors.New(\n\t\t\t\t\"can not update mount options while volume is in use\"))\n\t\t}\n\t} else {\n\t\tv.MountOptions = other.MountOptions\n\t}\n\n\t// Secrets can be updated freely\n\tv.Secrets = other.Secrets\n\n\t// must be compatible with parameters set by from CreateVolumeResponse\n\n\tif len(other.Parameters) != 0 && !maps.Equal(v.Parameters, other.Parameters) {\n\t\terrs = multierror.Append(errs, errors.New(\n\t\t\t\"volume parameters cannot be updated\"))\n\t}\n\n\t// Context is mutable and will be used during controller validation, but we\n\t// need to ensure we don't remove context that's been previously stored","sourceCodeStart":824,"sourceCodeEnd":860,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/structs/csi.go#L824-L860","documentation":"Raised by CSIVolume.Merge (nomad/structs/csi.go:842) when mount options (fs type, mount flags) are changed on a volume that is currently in use. Nomad allows MountOptions updates only while no allocation is claiming the volume, because the mount is already established on running workloads and cannot be safely altered.","triggerScenarios":"`nomad volume update` (or job spec volume merge) where v.InUse() is true (volume has active claims from allocations) and !v.MountOptions.Equal(other.MountOptions).","commonSituations":"Trying to change mount flags such as 'ro'/'rw' or fs type while the volume is mounted by a running allocation; adding/removing mount flags during live workloads; scripts that resubmit full volume specs with tweaked mount options.","solutions":["Stop all allocations that use the volume so claims are released, then resubmit the update","Keep MountOptions unchanged in the update (equal values pass even while in use)","If a permanent option change is needed while workloads run, create a separate volume with the new mount options and migrate the jobs"],"exampleFix":"// before (volume in use)\nmount_options {\n  fs_type     = \"ext4\"\n  mount_flags = [\"ro\"] # changed while volume is mounted\n}\n// after: stop allocations first, or keep options unchanged until volume is free\nmount_options {\n  fs_type     = \"ext4\"\n  mount_flags = [\"rw\"] # submitted after all claims released\n}","handlingStrategy":"validation","validationCode":"// check in-use state before changing mount options\nif existing.InUse() && !existing.MountOptions.Equal(update.MountOptions) {\n    return errors.New(\"stop all allocations using this volume before changing mount options\")\n}","typeGuard":"func mountOptionsMutable(existing, update *structs.CSIVolume) bool {\n    return !existing.InUse() || existing.MountOptions.Equal(update.MountOptions)\n}","tryCatchPattern":null,"preventionTips":["Run `nomad volume status` and confirm 0 allocations before touching mount options","Automate updates in a workflow: stop jobs -> update volume -> restart jobs","Keep mount flags (ro/rw, fs_type) stable across spec edits"],"tags":["csi","nomad","volume","mount-options","in-use"],"backgroundTag":"resource-in-use-update-rejected","analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}