Problem Description
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
}
}
Explanation
For the first step, ensure that you have not accidentally 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.
Solution
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.
- Search for file recovery tools for Linux. For example: File recovery - ArchWiki.
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.