A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://cloud.google.com/compute/docs/disks/add-local-ssd below:

Add a Local SSD to your VM | Compute Engine Documentation

Skip to main content Add a Local SSD to your VM

Stay organized with collections Save and categorize content based on your preferences.

Local SSDs are designed for temporary storage use cases such as caches or scratch processing space. Because Local SSDs are located on the physical machine where your VM is running, they can be created only during the VM creation process. Local SSDs cannot be used as boot devices.

For third generation machine series and later, a set amount of Local SSD disks are added to the VM when you create it. The only way to add Local SSD storage to these VMs is:

For M3 and first and second generation machine types, you must specify Local SSD disks when creating the VM.

After creating a Local SSD disk, you must format and mount the device before you can use it.

For information about the amount of Local SSD storage available with various machine types, and the number of Local SSD disks you can attach to a VM, see Choosing a valid number of Local SSDs.

Before you begin Create a VM with a Local SSD

You can create a VM with Local SSD disk storage using the Google Cloud console, the gcloud CLI, or the Compute Engine API.

Console
  1. Go to the Create an instance page.

    Go to Create an instance

  2. Specify the name, region, and zone for your VM. Optionally, add tags or labels.

  3. In the Machine configuration section, choose the machine family that contains your target machine type.

  4. Select a series from the Series list, then choose the machine type.

  5. Continue with the VM creation process.

  6. After creating the VM with Local SSD disks, you must format and mount each device before you can use the disks.

gcloud

Replace the following:

If necessary, you can attach Local SSDs to a first or second generation VM using a combination of nvme and scsi for different partitions. Performance for the nvme device depends on the boot disk image for your instance. Third generation VMs only support the NVMe disk interface.

After creating a VM with Local SSD, you must format and mount each device before you can use it.

Terraform

To create a VM with attached Local SSD disks, you can use the google_compute_instance resource.

To learn how to apply or remove a Terraform configuration, see Basic Terraform commands.

To generate the Terraform code, you can use the Equivalent code component in the Google Cloud console.
  1. In the Google Cloud console, go to the VM instances page.

    Go to VM Instances

  2. Click Create instance.
  3. Specify the parameters you want.
  4. At the top or bottom of the page, click Equivalent code, and then click the Terraform tab to view the Terraform code.
Go Go

Before trying this sample, follow the Go setup instructions in the Compute Engine quickstart using client libraries. For more information, see the Compute Engine Go API reference documentation.

To authenticate to Compute Engine, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.

Java Java

Before trying this sample, follow the Java setup instructions in the Compute Engine quickstart using client libraries. For more information, see the Compute Engine Java API reference documentation.

To authenticate to Compute Engine, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.

Python Python

Before trying this sample, follow the Python setup instructions in the Compute Engine quickstart using client libraries. For more information, see the Compute Engine Python API reference documentation.

To authenticate to Compute Engine, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.

REST

Use the instances.insert method to create a VM from an image family or from a specific version of an operating system image.

After creating a Local SSD disk, you must format and mount each device before you can use it.

For more information on creating an instance using REST, see the Compute Engine API.

Format and mounting a Local SSD device

You can format and mount each Local SSD disk individually, or you can combine multiple Local SSD disks into a single logical volume.

Format and mount individual Local SSD partitions

The easiest way to connect Local SSDs to your instance is to format and mount each device with a single partition. Alternatively, you can combine multiple partitions into a single logical volume.

Linux instances

Format and mount the new Local SSD on your Linux instance. You can use any partition format and configuration that you need. For this example, create a single ext4 partition.

  1. Go to the VM instances page.

    Go to VM instances

  2. Click the SSH button next to the instance that has the new attached Local SSD. The browser opens a terminal connection to the instance.

  3. In the terminal, use the find command to identify the Local SSD that you want to mount.

    $ find /dev/ | grep google-local-nvme-ssd
    

    Local SSDs in SCSI mode have standard names like google-local-ssd-0. Local SSDs in NVMe mode have names like google-local-nvme-ssd-0, as shown in the following output:

     $ find /dev/ | grep google-local-nvme-ssd
    
     /dev/disk/by-id/google-local-nvme-ssd-0
    
  4. Format the Local SSD with an ext4 file system. This command deletes all existing data from the Local SSD.

    $ sudo mkfs.ext4 -F /dev/disk/by-id/[SSD_NAME]
    

    Replace [SSD_NAME] with the ID of the Local SSD that you want to format. For example, specify google-local-nvme-ssd-0 to format the first NVMe Local SSD on the instance.

  5. Use the mkdir command to create a directory where you can mount the device.

    $ sudo mkdir -p /mnt/disks/[MNT_DIR]
    

    Replace [MNT_DIR] with the directory path where you want to mount your Local SSD disk.

  6. Mount the Local SSD to the VM.

    $ sudo mount /dev/disk/by-id/[SSD_NAME] /mnt/disks/[MNT_DIR]
    

    Replace the following:

  7. Configure read and write access to the device. For this example, grant write access to the device for all users.

    $ sudo chmod a+w /mnt/disks/[MNT_DIR]
    

    Replace [MNT_DIR] with the directory where you mounted your Local SSD.

Optionally, you can add the Local SSD to the /etc/fstab file so that the device automatically mounts again when the instance restarts. This entry does not preserve data on your Local SSD if the instance stops. See Local SSD data persistence for complete details.

When you specify the entry /etc/fstab file, be sure to include the nofail option so that the instance can continue to boot even if the Local SSD is not present. For example, if you take a snapshot of the boot disk and create a new instance without any Local SSD disks attached, the instance can continue through the startup process and not pause indefinitely.

  1. Create the /etc/fstab entry. Use the blkid command to find the UUID for the file system on the device and edit the /etc/fstab file to include that UUID with the mount options. You can complete this step with a single command.

    For example, for a Local SSD in NVMe mode, use the following command:

    $ echo UUID=`sudo blkid -s UUID -o value /dev/disk/by-id/google-local-nvme-ssd-0` /mnt/disks/[MNT_DIR] ext4 discard,defaults,nofail 0 2 | sudo tee -a /etc/fstab
    

    For a Local SSD in a non-NVMe mode such as SCSI, use the following command:

    $ echo UUID=`sudo blkid -s UUID -o value /dev/disk/by-id/google-local-ssd-0` /mnt/disks/[MNT_DIR] ext4 discard,defaults,nofail 0 2 | sudo tee -a /etc/fstab
    

    Replace [MNT_DIR] with the directory where you mounted your Local SSD.

  2. Use the cat command to verify that your /etc/fstab entries are correct:

    $ cat /etc/fstab
    

If you create a snapshot from the boot disk of this instance and use it to create a separate instance that does not have Local SSDs, edit the /etc/fstab file and remove the entry for this Local SSD. Even with the nofail option in place, keep the /etc/fstab file in sync with the partitions that are attached to your instance and remove these entries before you create your boot disk snapshot.

Windows instances

Use the Windows Disk Management tool to format and mount a Local SSD on a Windows instance.

  1. Connect to the instance through RDP. For this example, go to the VM instances page and click the RDP button next the instance that has the Local SSDs attached. After you enter your username and password, a window opens with the desktop interface for your server.

  2. Right-click the Windows Start button and select Disk Management.

  3. If you have not initialized the Local SSD before, the tool prompts you to select a partitioning scheme for the new partitions. Select GPT and click OK.

  4. After the Local SSD initializes, right-click the unallocated disk space and select New Simple Volume.

  5. Follow the instructions in the New Simple Volume Wizard to configure the new volume. You can use any partition format that you like, but for this example select NTFS. Also, check Perform a quick format to speed up the formatting process.

  6. After you complete the wizard and the volume finishes formatting, check the new Local SSD to ensure it has a Healthy status.

That's it! You can now write files to the Local SSD.

Format and mount multiple Local SSD partitions into a single logical volume

Unlike persistent SSDs, Local SSDs have a fixed 375 GB capacity for each device that you attach to the instance. If you want to combine multiple Local SSD partitions into a single logical volume, you must define volume management across these partitions yourself.

Note: Due to the underlying hardware configuration, using parity or mirroring RAID levels across Local SSD partitions does not provide any actual reliability or redundancy benefit. Use RAID 0 to get the best performance and the greatest capacity from your Local SSD arrays. Linux instances

Use mdadm to create a RAID 0 array. This example formats the array with a single ext4 file system, but you can apply any file system that you prefer.

Note: Although you can create an /etc/fstab entry to automatically mount the Local SSD during an instance reboot, it does not allow data on the Local SSD to persist through stopping or preemption.
  1. Go to the VM instances page.

    Go to VM instances

  2. Click the SSH button next to the instance that has the new attached Local SSD. The browser opens a terminal connection to the instance.

  3. In the terminal, install the mdadm tool. The install process for mdadm includes a user prompt that halts scripts, so run this process manually.

    Debian and Ubuntu:

    $ sudo apt update && sudo apt install mdadm --no-install-recommends
    

    CentOS and RHEL:

    $ sudo yum install mdadm -y
    

    SLES and openSUSE:

    $ sudo zypper install -y mdadm
    
  4. Use the find command to identify all of the Local SSDs that you want to mount together.

    For this example, the instance has eight Local SSD partitions in NVMe mode:

    $  find /dev/ | grep google-local-nvme-ssd
    
     /dev/disk/by-id/google-local-nvme-ssd-7
     /dev/disk/by-id/google-local-nvme-ssd-6
     /dev/disk/by-id/google-local-nvme-ssd-5
     /dev/disk/by-id/google-local-nvme-ssd-4
     /dev/disk/by-id/google-local-nvme-ssd-3
     /dev/disk/by-id/google-local-nvme-ssd-2
     /dev/disk/by-id/google-local-nvme-ssd-1
     /dev/disk/by-id/google-local-nvme-ssd-0
    

    find does not guarantee an ordering. It's alright if the devices are listed in a different order as long as number of output lines match the expected number of SSD partitions. Local SSDs in SCSI mode have standard names like google-local-ssd. Local SSDs in NVMe mode have names like google-local-nvme-ssd.

  5. Use mdadm to combine multiple Local SSD devices into a single array named /dev/md0. This example merges eight Local SSD devices in NVMe mode. For Local SSD devices in SCSI mode, specify the names that you obtained from the find command:

    $ sudo mdadm --create /dev/md0 --level=0 --raid-devices=8 \
     /dev/disk/by-id/google-local-nvme-ssd-0 \
     /dev/disk/by-id/google-local-nvme-ssd-1 \
     /dev/disk/by-id/google-local-nvme-ssd-2 \
     /dev/disk/by-id/google-local-nvme-ssd-3 \
     /dev/disk/by-id/google-local-nvme-ssd-4 \
     /dev/disk/by-id/google-local-nvme-ssd-5 \
     /dev/disk/by-id/google-local-nvme-ssd-6 \
     /dev/disk/by-id/google-local-nvme-ssd-7
    
    mdadm: Defaulting to version 1.2 metadata
    mdadm: array /dev/md0 started.
    
    

    You can confirm the details of the array with mdadm --detail. Adding the --prefer=by-id flag will list the devices using the /dev/disk/by-id paths.

     sudo mdadm --detail --prefer=by-id /dev/md0
     

    The output should look similar to the following for each device in the array.

     ...
     Number   Major   Minor   RaidDevice State
        0      259      0         0      active sync   /dev/disk/by-id/google-local-nvme-ssd-0
     ...
     
  6. Format the full /dev/md0 array with an ext4 file system.

    Caution: This command deletes all existing data from the Local SSDs.
    $ sudo mkfs.ext4 -F /dev/md0
    
  7. Create a directory to where you can mount /dev/md0. For this example, create the /mnt/disks/ssd-array directory:

    $ sudo mkdir -p /mnt/disks/[MNT_DIR]
    

    Replace [MNT_DIR] with the directory where you want to mount your Local SSD array.

  8. Mount the /dev/md0 array to the /mnt/disks/ssd-array directory:

    $ sudo mount /dev/md0 /mnt/disks/[MNT_DIR]
    

    Replace [MNT_DIR] with the directory where you want to mount your Local SSD array.

  9. Configure read and write access to the device. For this example, grant write access to the device for all users.

    $ sudo chmod a+w /mnt/disks/[MNT_DIR]
    

    Replace [MNT_DIR] with the directory where you mounted your Local SSD array.

Optionally, you can add the Local SSD to the /etc/fstab file so that the device automatically mounts again when the instance restarts. This entry does not preserve data on your Local SSD if the instance stops. See Local SSD data persistence for details.

When you specify the entry /etc/fstab file, be sure to include the nofail option so that the instance can continue to boot even if the Local SSD is not present. For example, if you take a snapshot of the boot disk and create a new instance without any Local SSDs attached, the instance can continue through the startup process and not pause indefinitely.

  1. Create the /etc/fstab entry. Use the blkid command to find the UUID for the file system on the device and edit the /etc/fstab file to include that UUID with the mount options. Specify the nofail option to allow the system to boot even if the Local SSD is unavailable.You can complete this step with a single command. For example:

    $ echo UUID=`sudo blkid -s UUID -o value /dev/md0` /mnt/disks/[MNT_DIR] ext4 discard,defaults,nofail 0 2 | sudo tee -a /etc/fstab
    

    Replace [MNT_DIR] with the directory where you mounted your Local SSD array.

  2. If you use a device name like /dev/md0 in the /etc/fstab file instead of the UUID, you need to edit the file /etc/mdadm/mdadm.conf to make sure the array is reassembled automatically at boot. To do this, complete the following two steps:

    1. Make sure the disk array is scanned and reassembled automatically at boot.
      $ sudo mdadm --detail --scan | sudo tee -a /etc/mdadm/mdadm.conf
      
    2. Update initramfs so that the array will be available during the early boot process.
      $ sudo update-initramfs -u
      
  3. Use the cat command to verify that your /etc/fstab entries are correct:

    $ cat /etc/fstab
    

If you create a snapshot from the boot disk of this instance and use it to create a separate instance that does not have Local SSDs, edit the /etc/fstab file and remove the entry for this Local SSD array. Even with the nofail option in place, keep the /etc/fstab file in sync with the partitions that are attached to your instance and remove these entries before you create your boot disk snapshot.

Windows instances

Use the Windows Disk Management tool to format and mount an array of Local SSDs on a Windows instance.

  1. Connect to the instance through RDP. For this example, go to the VM instances page and click the RDP button next the instance that has the Local SSDs attached. After you enter your username and password, a window opens with the desktop interface for your server.

  2. Right-click the Windows Start button and select Disk Management.

  3. If you have not initialized the Local SSDs before, the tool prompts you to select a partitioning scheme for the new partitions. Select GPT and click OK.

  4. After the Local SSD initializes, right-click the unallocated disk space and select New Striped Volume.

  5. Select the Local SSD partitions that you want to include in the striped array. For this example, select all of the partitions to combine them into a single Local SSD device.

  6. Follow the instructions in the New Striped Volume Wizard to configure the new volume. You can use any partition format that you like, but for this example select NTFS. Also, check Perform a quick format to speed up the formatting process.

  7. After you complete the wizard and the volume finishes formatting, check the new Local SSD to ensure it has a Healthy status.

You can now write files to the Local SSD.

What's next

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-08-07 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["Local SSDs are temporary storage options designed for use cases like caches or scratch processing, and they are directly located on the physical machine running your VM."],["Local SSDs can only be added during VM creation, they can't be used as boot devices, and certain machine series (C3, C3D) require specific machine types (e.g., `c3-standard-88-lssd`) to utilize Local SSD storage."],["Third-generation machine series (Z3, A3, A2 ultra) automatically include Local SSD storage with every machine type, while M3 and first/second-generation machines require specifying Local SSD disks during VM creation."],["After creating a Local SSD disk, it must be formatted and mounted before it can be used, and this can be done individually for each disk or by combining multiple Local SSDs into a single logical volume."],["It's crucial to review the Local SSD limitations and data persistence scenarios, and users must set up authentication to access Google Cloud services and APIs for utilizing Local SSDs."]]],[]]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4