Creating manual BlockDevice

BlockDevices are the consumable units of storage in the OpenEBS storage solution. Currently, NDM supports the discovery and management of only a complete disk.

BlockDevice

However, users can create BlockDevices manually to support custom partitions/lvms, etc., which are not detected by NDM. To create a manual BlockDevice, follow the steps below:

  1. Download the sample block device custom resource YAML file.
    ```
    wget
    https://raw.githubusercontent.com/openebs/node-disk-manager/master/deploy/crds/openebs_v1alpha1_blockdevice_cr.yaml

    ```
  2. Edit the file and fill in the details of the blockdevice. Fields marked with optional are not mandatory and can be removed. All other fields are required and information provided will be used while claiming.
    ```
    apiVersion: openebs.io/v1alpha1
    kind: BlockDevice
    metadata:
     name: example-blockdevice
     labels:
       kubernetes.io/hostname: <host name of the node in which disk/blockdevice is attached> # like gke-openebs-user-default-pool-044afcb8-bmc0
       ndm.io/managed: "false" # for manual disk creation put false
       ndm.io/blockdevice-type: blockdevice
    status:
     claimState: Unclaimed
     state: Active
    spec:
     capacity:
          storage: <total capacity in bytes> #like 53687091200
     details:
       firmwareRevision: <firmware revision> #optional
       model: <model name of blockdevice> # like PersistentDisk, optional
       serial: <serial no of disk> # like google-disk-2, optional
       compliance: <compliance of disk> #like "SPC-4", optional
       vendor: <vendor of disk> #like Google, optional
     devlinks:
     - kind: by-id
       links:
       - <link1> # like /dev/disk/by-id/scsi-0Google_PersistentDisk_disk-2
       - <link2> # like /dev/disk/by-id/google-disk-2
     - kind: by-path
       links:
       - <link1> # like /dev/disk/by-path/virtio-pci-0000:00:03.0-scsi-0:0:2:0
     nodeAttributes:
       nodeName: <node name> # output of `kubectl get nodes` can be used
     path: <devpath> # like /dev/sdb
    ```
  3. Apply the YAML file.
```
kubectl apply -f openebs_v1alpha1_blockdevice_cr.yaml
```

The BlockDevice CR will be created and is then used by NDM Operator for claiming, but it won’t be managed by NDM Daemon for any changes that happen on the device. However, all the Claim/Unclaim operations and cleanup operations will be performed on this BlockDevice.

Please provide your valuable feedback & comments below and let me know what I can cover in my next blog.

Loved this blog? Read more of our blogs here

Jeffry Molanus
Jeffry prior to being CTO at MayaData has worked at several other startups in the storage industry. He worked on several scale out object storage products as well as traditional NAS and SAN storage solutions where he held technical leadership roles. At MayaData, his primary focus will be around making sure the product is flexible and scalable yet robust enough to be integrated seamlessly into modern day infrastructure where he believes, containers will have a dominant role. Jeffry holds a master degree in electrical engineering with a focus on distributed control engineering from the University Twente in the Netherlands. When he is not working with code, he practices martial arts.
Saumya Sharma
I am a Software Engineer turned Digital Marketer. Being from a Computer Science background, Software Engineering never thrilled me. I believe learning is a continuous process, and it's never too late to start a new phase of life. I am currently working on SEO and blog setups. In my free time, I love to read and write. I have a blog named The Inked Perception, where I post my poetry. I also love to travel and binge-watch web series.
Pawan Sharma
It's been an amazing experience in Software Engineering because of my love for coding. I have a very good system understanding and I enjoy solving puzzles. In my free time, I read books, play table tennis and watch tv series