Using OS partition as a device in Aerospike

Problem

On installing Aerospike with the following namespace configuration, I am unable to access any of my local disk or programs. Aerospike is working as expected.

namespace test {
        replication-factor 2
        memory-size 4G
        default-ttl 30d # 30 days, use 0 to never expire/evict.
        storage-engine device {
                      device /dev/sdb
                      write-block-size 128K
        }
}

Solution

For the first step, ensure that you have not accidently configured the OS partition to be used in the storage-engine device.

df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            7.4G     0  7.4G   0% /dev
tmpfs           1.6G   18M  1.6G   2% /run
**/dev/sdb      9.0Z  9.0Z  286G 100% /**
tmpfs           7.8G   28M  7.8G   1% /dev/shm
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           7.8G     0  7.8G   0% /sys/fs/cgroup
/dev/sda1       511M  3.4M  508M   1% /boot/efi
tmpfs           1.6G   68K  1.6G   1% /run/user/1000

For example, if the above setup has the Operating System (or any other non-Aerospike data) on sdb, Aerospike might have overwritten those.

Unfortunately, there is no simple way to recover the data. To understand the impact, Aerospike would have over-written the first 1MB of the device and in addition the approximate amount of data that was written.

In order to recover any files from that device:

  • Stop writing to the device (this includes not using an OS on that device).
  • You can create a backup of the device so that you can later recover uncorrupted files using the following command:
dd if=/dev/sda2 of=path/to/backup/file # Ensure that this file is not on /dev/sda2 or you will cause more data to not be recoverable. 

Workaround

If you do not have an empty partition that can be dedicated to Aerospike, file or storage-engine memory configurations could be alternately used.

Refer to the documentation for different Storage Engine Configuration Recipes for further details.

Note

Aerospike requires the configured devices to be dedicated to Aerospike. Aerospike also does not allow the same device partitions to be shared amongst different namespaces.

Keywords

OS DEVICE PARTITION

Timestamp

June 17 2019

Is it not trivial to just add a mountpoint/fs check? Or check that the device contains valid Aerospike data or 0’s?