How to find the correct devicePaths to use in local storage for an Openshift Persistent Volume?

367 views Asked by At

I've seen the docs to create Custom Resources for Local Storage: https://docs.openshift.com/container-platform/4.5/storage/persistent_storage/persistent-storage-local.html#local-volume-cr_persistent-storage-local

But not sure how to populate the spec.storageClassDevices.devicePaths field.

I've tried the lsblk command in one of my nodes and got this response:

sh-4.4# lsblk
NAME                         MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
vda                          252:0    0   250G  0 disk 
|-vda1                       252:1    0   384M  0 part /boot
|-vda2                       252:2    0   127M  0 part /boot/efi
|-vda3                       252:3    0     1M  0 part 
`-vda4                       252:4    0 249.5G  0 part 
  `-coreos-luks-root-nocrypt 253:0    0 249.5G  0 dm   /sysroot
vdb                          252:16   0   200G  0 disk 
vdc                          252:32   0   200G  0 disk 
1

There are 1 answers

0
mario On

On Linux and other Unix-like systems your block devices are represented in the filesystem as files so each block device has its unique path, the same way as regular file.

Instead of running lsblk you can run df command which will show you those paths however it will show you only the devices which are already mounted.

All block devices on your system start with vd so you can simply run:

ls -l /dev/vd*

to list them all.

So if you want to mount e.g. your vdb and vdc disks, the values for spec.storageClassDevices.devicePaths will be /dev/vdb and /dev/vdc:

spec:
  ... 
  storageClassDevices:
    - storageClassName: "local-sc"
      volumeMode: Filesystem 
      fsType: xfs 
      devicePaths: 
        - /dev/vdb 
        - /dev/vdc