Disks and Filesystem

This page provides an overview of the Container-Optimized OS from Google filesystem and describes how to mount and format disks.

Filesystem

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

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
/
  • read-only
  • executable
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
  • writable
  • non-executable
  • stateful
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/cloud
/var/lib/docker
/var/lib/kubelet
/var/lib/toolbox
  • writable
  • executable
  • stateful
These paths are working directories for Compute Engine packages (for example, the accounts manager service), cloud-init, Docker, Kubelet, and Toolbox respectively.
/etc
  • writable
  • non-executable
  • stateless
  • tmpfs
/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
  • writable
  • non-executable
  • stateless
  • tmpfs
/tmp is typically used as a scratch space and should not be used to store persistent data.
/mnt/disks
  • writable
  • executable
  • stateless
  • tmpfs
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 from Google. 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 your cloud-config's bootcmd section. For example:

#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]

Please refer to fsck.ext4 and mount documentation for a full set of options supported by these commands.

Segítségére volt ez az oldal? Tudassa velünk a véleményét:

Visszajelzés küldése a következővel kapcsolatban: