Skip to content

Sparse Disks

Murat Karslioglu edited this page Oct 3, 2019 · 6 revisions

Overview

NDM provisions Sparse Disks to help developer and/or ci systems to simulate disks. This feature also comes in handy to create some quick demo's for Kubernetes solutions that require disks to be available. NDM Sparse Disks are Linux truncated files of required size.

Configuration

The creation of the sparse files by NDM can be controlled using the ENV parameters in ndm-operator.yaml.

You can use the following ENV parameters of NDM to customize how sparse disks are created:

  • SPARSE_FILE_DIR : Host directory where the sparse files should be created. If not present, then sparse files and corresponding Disk CR will not be created
  • SPARSE_FILE_SIZE : Size in bytes of the sparse files to be created
  • SPARSE_FILE_COUNT : Number of sparse files to created.

The naming convention for sparse file is as follows: <SPARSE_FILE_DIR>/<count>-ndm-sparse.img

Note: If there is an existing sparse file in the SPARSE_FILE_DIR, it will be re-used. This is to help with scenarios where data may be written to the sparse disks and need to be re-used across restarts of NDM.

Creating Sparse Disks on CentOS Node

SELinux needs to be either disabled or the NDM pods given the privilege to create disks on the SPARSE_FILE_DIR

Example Sparse Disk

apiVersion: openebs.io/v1alpha1
kind: Disk
metadata:
  clusterName: ""
  creationTimestamp: 2018-09-01T03:54:35Z
  labels:
    kubernetes.io/hostname: gke-kmova-helm-default-pool-e35ad688-mfg9
    ndm.io/disk-type: sparse
  name: sparse-4ba6c63a2eaaf9fcf453df3011deb107
  namespace: ""
  resourceVersion: "6129"
  selfLink: /apis/openebs.io/v1alpha1/sparse-4ba6c63a2eaaf9fcf453df3011deb107
  uid: be0c997f-ad9a-11e8-84a3-42010a800196
spec:
  capacity:
    logicalSectorSize: 0
    storage: 1073741824
  details:
    firmwareRevision: ""
    model: ""
    serial: ""
    spcVersion: ""
    vendor: ""
  path: /var/openebs/0-ndm-sparse.img
status:
  state: Active
Clone this wiki locally