From 8efefab9a3fdc4906ca53d4a23d22c3846d0610b Mon Sep 17 00:00:00 2001 From: Tim Hockin Date: Sun, 3 Jul 2016 21:30:18 -0700 Subject: [PATCH] Mount r/w GCE PD disks with -o discard As per https://cloud.google.com/compute/docs/disks/add-persistent-disk#formatting. --- pkg/volume/gce_pd/attacher.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/volume/gce_pd/attacher.go b/pkg/volume/gce_pd/attacher.go index c60a02aeaee..b9485268dd1 100644 --- a/pkg/volume/gce_pd/attacher.go +++ b/pkg/volume/gce_pd/attacher.go @@ -165,6 +165,9 @@ func (attacher *gcePersistentDiskAttacher) MountDevice(spec *volume.Spec, device options := []string{} if readOnly { options = append(options, "ro") + } else { + // as per https://cloud.google.com/compute/docs/disks/add-persistent-disk#formatting + options = append(options, "discard") } if notMnt { diskMounter := &mount.SafeFormatAndMount{Interface: mounter, Runner: exec.New()}