A RetroSearch Logo

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

Search Query:

Showing content from https://cloud.google.com/container-optimized-os/docs/concepts/disks-and-filesystem below:

Disks and file system overview | Container-Optimized OS

Skip to main content Disks and file system overview

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

This page provides an overview of the Container-Optimized OS file system and describes how to mount and format disks.

File system

The Container-Optimized OS node image file system layout is optimized to enhance node security. The boot disk space is split into three types of partitions:

When using Container-Optimized OS, be aware of the partitioning if you run your own services that have certain expectations about the file system layout outside of containers.

The root file system is mounted as read-only to protect system integrity. However, home directories and /mnt/stateful_partition are persistent and writable.

Working with the Container-Optimized OS file system

The following is a list of paths in the Container-Optimized OS node image file system, along with their properties and recommended usage:

Path Properties Purpose / The root filesystem is mounted as read-only to maintain integrity. The kernel verifies integrity root filesystem during boot up, and refuses to boot in case of errors. /home
/var
These paths are meant for storing data that persists for the lifetime of the boot disk. They are mounted from /mnt/stateful_partition. /var/lib/google
/var/lib/docker
/var/lib/toolbox These paths are working directories for Compute Engine packages (for example, the accounts manager service), Docker, and Toolbox respectively. /var/lib/cloud This path is the working directory of the cloud-init package. /etc Typically holds your configuration (for example, systemd services defined via cloud-init). It's a good idea to capture the desired state of your instances in cloud-init, as cloud-init is applied when an instance is newly created as well as when an instance is restarted. /tmp Typically used as a scratch space and should not be used to store persistent data. /mnt/disks You can mount persistent disks at directories under /mnt/disks. Mounting and formatting disks

You can attach a persistent disk or create an instance with Local SSDs when using Container-Optimized OS. Follow the instructions on Formatting and mounting a persistent disk or Format and mount a local SSD device for the appropriate use-case.

The disks can be mounted by creating a subdirectory under /mnt/disks directory. Since /etc/ is stateless on Container-Optimized OS, you cannot use /etc/fstab to automatically fsck (file system consistency check) and mount the disks on boot. But you can achieve the same by doing those operations from the bootcmd section in your cloud-config.

The following example mounts the disk DEVICE_ID under the /mnt/disks directory.

  1. Create a script file using the following contents:

    #cloud-config
    
    bootcmd:
    - fsck.ext4 -tvy /dev/DEVICE_ID
    - mkdir -p /mnt/disks/MNT_DIR
    - mount -t ext4 -o ... /dev/DEVICE_ID /mnt/disks/MNT_DIR
    

    Replace the following:

    Refer to the Linux documentation for a full set of options supported by the fsck.ext4 and mount commands.

  2. Update the VM metadata to include the script file by using the --metadata-from-file flag.

    To create a VM, use the following command:

    gcloud compute instances create INSTANCE_NAME \
        --metadata-from-file user-data=SCRIPT_FILE_NAME
    

    To update an existing instance, use the following command:

    gcloud compute instances add-metadata INSTANCE_NAME \
        --metadata-from-file user-data=SCRIPT_FILE_NAME
    

    Replace the following:

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."],[[["Container-Optimized OS uses a file system layout with read-only root, stateful, and stateless partitions to enhance node security."],["The root file system is read-only to protect system integrity, but home directories and `/mnt/stateful_partition` are writable and persistent."],["Specific paths like `/var/lib/google`, `/var/lib/docker`, and `/var/lib/toolbox` are designated for working directories of certain services, and are stateful."],["Persistent disks can be attached and mounted under `/mnt/disks` using `cloud-config` scripts, as the `/etc/fstab` method is not available due to the stateless nature of `/etc/`."],["You can use `cloud-init` to handle configuration and mounting of disks on Container-Optimized OS instances, ensuring that configurations are applied on creation and restarts."]]],[]]


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