mount.gce-pd
- create and mount a persistent disk, deleting on unmount
mount.gce-pd
DISK_NAME MOUNTPOINT [-sfnv] -o size=SIZE[,OPTIONS]
-t gce-pd.FSTYPE
This is a tool designed to be used as a file system type on Linux machines running on Google Compute Engine. It allows on-mount creation of Persistent Disks and on-unmount deletion of them. This can then be used in conjunction with Linux's Automount, enabling on-demand scratch disks.
Since Compute Engine charges for disk use on a per-gigabyte basis, if you have infrequently used jobs which need scratch space, you can use this to automatically create and delete these disks as needed, thereby reducing cost.
Because mount.gce-pd
modifies persistent disks, it needs authorized
credentials to do so. To provide those credentials, create your instance with
the https://www.googleapis.com/auth/compute
scope (aliased to compute-rw
in
the gcloud
CLI). Read Authorizing Requests to Google Compute Engine
for more information about scopes in Google Cloud.
-f
See the -f
option in mount(8).
-n
See the -n
option in mount(8).
-o
MOUNT_OPTIONSProvide mount options. Options are specified with a -o
flag followed by a
comma separated string of options. Also see the section MOUNT OPTIONS and
the -o
option in mount(8).
Note: The size
option is required.
-s
See the -s
option in mount(8).
-t gce-pd.
FSTYPEDeclare the underlying filesystem to create on new persistent disks. FSTYPE
must be a valid filesystem type which can be created using mkfs.
FSTYPE
and mounted using mount -t
FSTYPE.
Note: This option is required.
-v
Enable verbose logging. Also see the -v
option in mount(8).
chmod=
MODEChange access permissions on the mounted filesystem after creation. This
accepts access modes in all valid MODE
formats of chmod(1).
chown=
OWNER[:GROUP]Change the owner and group of the mounted filesystem after creation. This
accepts owner and group in all valid formats of user-spec as specified in
chown
in the ZSH/FILES
section of zshmodules(1).
help
Print usage information and exit.
size=
SIZEThe size of the persistent disk. Accepts all values accepted by the --size
option of gcloud compute disks create
. See the
gcloud documentation for more information.
Note: This option is required.
syslog
Log to syslog(3) instead of stdout.
Any mount options not recognized by mount.gce-pd
are passed to the mount
command used to mount the created filesystem. See mount(8) and the
documentation for the created filesystem type for additional information.
mount media /mnt/media -o size=10GiB -t gce-pd.ext4
media /mnt/media gce-pd.ext4 size=10GiB 0 0
syslog
mount option, otherwise accesses to the mounted
filesystem will hang.If Google Cloud Monitoring's Stackdriver Agent is
used, you must configure the agent to ignore automounted directories,
otherwise those directories will never unmount. This can be accomplished by
putting the following in
/opt/stackdriver/collectd/etc/collectd.d/<SOME_NAME>.conf
:
<Plugin "df">
MountPoint "/path/to/automounted/directory"
</Plugin>
Written by Russell Harmon.
You can find us at our github page.
mount(8), chmod(1), zshmodules(1), syslog(3), gcloud compute disks create