How to configure storage device to use the disk WWID


#1

FAQ How to configure storage device to use the disk WWID.

Context

Device names are not always guaranteed to be attached to the same underlying physical disks upon reboot. In some cases the default drive names may get re-ordered such that /dev/sdX and /dev/sdY may point to different disk devices after a reboot. The disk re-ordering could occur if your machine has more than one SATA, SCSI or IDE disk controller. The order in which the corresponding device nodes are added is arbitrary. There are four different schemes for persistent disk naming: by-label, by-uuid, by-id (WWID) and by-path. We will focus in this article on configuring our storage-engine to use a disk identified by its WWID. The World Wide Identifier (WWID) can be used in reliably identifying devices.

Method

In order to ensure that each namespace always use the exact partition(s)/disk(s) that were originally assigned, we can modify the storage engine device in aerospike.conf to use the WWID disk identifier. The World Wide Identifier (WWID) can be used in reliably identifying devices. It is a persistent, system-independent ID that the SCSI Standard requires from all disk devices. The WWID identifier is guaranteed to be unique for every storage device, and independent of the path that is used to access the device.

One caveat when configuring devices as such, is that the scheduler-mode configuration option will not take effect and will then have to be set at the OS level (see instructions below).

Determine the WWID with ls :


# ls -al /dev/disk/by-id/
total 0
drwxr-xr-x. 2 root root 380 Jan  7 17:19 .
drwxr-xr-x. 5 root root 100 Jan  7 17:19 ..
lrwxrwxrwx. 1 root root   9 Jan  7 17:19 ata-INTEL_SSDSA2CW300G3_CVPR208102VD300EGN -> ../../sdb
lrwxrwxrwx. 1 root root   9 Jan  7 17:19 ata-INTEL_SSDSA2CW300G3_CVPR208103MA300EGN -> ../../sdc
lrwxrwxrwx. 1 root root   9 Jan  7 17:19 ata-ST500DM002-1BD142_W2AA2EMN -> ../../sda
lrwxrwxrwx. 1 root root  10 Jan  7 17:19 ata-ST500DM002-1BD142_W2AA2EMN-part1 -> ../../sda1
lrwxrwxrwx. 1 root root  10 Jan  7 17:19 ata-ST500DM002-1BD142_W2AA2EMN-part2 -> ../../sda2

Initialize the drive if new system :

[root@v24 aerospike]# sudo dd if=/dev/zero of=/dev/disk/by-id/ata-INTEL_SSDSA2CW300G3_CVPR208102VD300EGN bs=1M&
[1] 1836
[root@v24 aerospike]# sudo dd if=/dev/zero of=/dev/disk/by-id/ata-INTEL_SSDSA2CW300G3_CVPR208103MA300EGN bs=1M&
[2] 1839

Configure namespace storage-engine to use WWID

namespace <namespace-name> {
    memory-size <SIZE>G         # Maximum memory allocation for primary
                                # and secondary indexes.
    storage-engine device {     # Configure the storage-engine to use persistence
        # device /dev/<device>    # raw device. Maximum size is 2 TiB
        device /dev/disk/by-id/ata-INTEL_SSDSA2CW300G3_CVPR208102VD300EGN
        device /dev/disk/by-id/ata-INTEL_SSDSA2CW300G3_CVPR208103MA300EGN
        # device /dev/<device>  # (optional) another raw device.
        write-block-size 128K   # adjust block size to make it efficient for SSDs.
    }
}

Manually Configure scheduler to use noop for your device:

Configure disk scheduler on a per device basis:
echo noop > /sys/block/sd<id number>/queue/scheduler

or

Configure disk scheduler globally for all devices :

define a global I/O scheduler (here noop) at boot, type:

# grubby --update-kernel=ALL --args="elevator=noop"

or

edit grub and change GRUB_CMDLINE_LINUX_DEFAULT=“quiet splash” to GRUB_CMDLINE_LINUX_DEFAULT=“quiet splash elevator=noop”

sudo vi /etc/default/grub
# add elevator=noop to GRUB_CMDLINE_LINUX_DEFAULT
sudo update-grub2

Configure scheduler based on device type:

In systems with different drive types you can adjust settings with a udev rule:

- create /etc/udev/rules.d/60-ssd-scheduler.rules
- Add the following rule:
# Set noop scheduler for non-rotating disks
ACTION=="add|change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="0",ATTR{queue/scheduler}="noop"

Notes

https://wiki.archlinux.org/index.php/persistent_block_device_naming

Keywords

Disk by-id storage-engine partitions persistent

Timestamp

10/10/16