File: //snap/google-cloud-cli/current/help/man/man1/gcloud_beta_compute_instances_detach-disk.1
.TH "GCLOUD_BETA_COMPUTE_INSTANCES_DETACH\-DISK" 1
.SH "NAME"
.HP
gcloud beta compute instances detach\-disk \- detach disks from Compute Engine virtual machine instances
.SH "SYNOPSIS"
.HP
\f5gcloud beta compute instances detach\-disk\fR \fIINSTANCE_NAME\fR (\fB\-\-device\-name\fR=\fIDEVICE_NAME\fR\ |\ \fB\-\-disk\fR=\fIDISK\fR) [\fB\-\-disk\-scope\fR=\fIDISK_SCOPE\fR;\ default="zonal"] [\fB\-\-zone\fR=\fIZONE\fR] [\fIGCLOUD_WIDE_FLAG\ ...\fR]
.SH "DESCRIPTION"
\fB(BETA)\fR \fBgcloud beta compute instances detach\-disk\fR is used to detach
disks from virtual machines.
Detaching a disk without first unmounting it may result in incomplete I/O
operations and data corruption. To unmount a persistent disk on a Linux\-based
image, ssh into the instance and run:
.RS 2m
$ sudo umount /dev/disk/by\-id/google\-DEVICE_NAME
.RE
.SH "EXAMPLES"
To detach a disk named 'my\-disk' from an instance named 'my\-instance', run:
.RS 2m
$ gcloud beta compute instances detach\-disk my\-instance \e
\-\-disk=my\-disk
.RE
To detach a device named 'my\-device' from an instance named 'my\-instance',
run:
.RS 2m
$ gcloud beta compute instances detach\-disk my\-instance \e
\-\-device\-name=my\-device
.RE
.SH "POSITIONAL ARGUMENTS"
.RS 2m
.TP 2m
\fIINSTANCE_NAME\fR
Name of the instance to operate on. For details on valid instance names, refer
to the criteria documented under the field 'name' at:
https://cloud.google.com/compute/docs/reference/rest/v1/instances
.RE
.sp
.SH "REQUIRED FLAGS"
.RS 2m
.TP 2m
Exactly one of these must be specified:
.RS 2m
.TP 2m
\fB\-\-device\-name\fR=\fIDEVICE_NAME\fR
Specifies a disk to detach by its device name, which is the name that the guest
operating system sees. The device name is set at the time that the disk is
attached to the instance, and needs not be the same as the persistent disk name.
If the disk's device name is specified, then its persistent disk name must not
be specified using the \f5\fI\-\-disk\fR\fR flag.
.TP 2m
\fB\-\-disk\fR=\fIDISK\fR
Specifies a disk to detach by its resource name. If you specify a disk to remove
by persistent disk name, then you must not specify its device name using the
\f5\fI\-\-device\-name\fR\fR flag.
.RE
.RE
.sp
.SH "OPTIONAL FLAGS"
.RS 2m
.TP 2m
\fB\-\-disk\-scope\fR=\fIDISK_SCOPE\fR; default="zonal"
The scope of the disk. \fIDISK_SCOPE\fR must be one of:
.RS 2m
.TP 2m
\fBregional\fR
The disk specified in \-\-disk is interpreted as a regional disk in the same
region as the instance. Ignored if a full URI is provided to the \f5\-\-disk\fR
flag.
.TP 2m
\fBzonal\fR
The disk specified in \-\-disk is interpreted as a zonal disk in the same zone
as the instance. Ignored if a full URI is provided to the \f5\-\-disk\fR flag.
.RE
.sp
.TP 2m
\fB\-\-zone\fR=\fIZONE\fR
Zone of the instance to operate on. If not specified, you might be prompted to
select a zone (interactive mode only). \f5gcloud\fR attempts to identify the
appropriate zone by searching for resources in your currently active project. If
the zone cannot be determined, \f5gcloud\fR prompts you for a selection with all
available Google Cloud Platform zones.
To avoid prompting when this flag is omitted, the user can set the
\f5\fIcompute/zone\fR\fR property:
.RS 2m
$ gcloud config set compute/zone ZONE
.RE
A list of zones can be fetched by running:
.RS 2m
$ gcloud compute zones list
.RE
To unset the property, run:
.RS 2m
$ gcloud config unset compute/zone
.RE
Alternatively, the zone can be stored in the environment variable
\f5\fICLOUDSDK_COMPUTE_ZONE\fR\fR.
.RE
.sp
.SH "GCLOUD WIDE FLAGS"
These flags are available to all commands: \-\-access\-token\-file, \-\-account,
\-\-billing\-project, \-\-configuration, \-\-flags\-file, \-\-flatten,
\-\-format, \-\-help, \-\-impersonate\-service\-account, \-\-log\-http,
\-\-project, \-\-quiet, \-\-trace\-token, \-\-user\-output\-enabled,
\-\-verbosity.
Run \fB$ gcloud help\fR for details.
.SH "NOTES"
This command is currently in beta and might change without notice. These
variants are also available:
.RS 2m
$ gcloud compute instances detach\-disk
.RE
.RS 2m
$ gcloud alpha compute instances detach\-disk
.RE