How to wipe an SSD for Aerospike?

Hello!

I have an SSD that has been used previously with Aerospike. I want to re-use it in a new Aerospike set up.

I used parted to create a new GPT label, then new partition, then formatted the partition as EXT4. Then I deleted the partition, and used the SSD in Aerospike with a new previously unused namespace name.

When I started up my new Aerospike config, before I inserted any records, I have the old sets & data, but showing up in the new namespace!

I do appreciate data persistence, but this is going a bit too far!

How can I wipe the SSD so Aerospike does not see old sets, and records?

EDIT: I found this (https://www.aerospike.com/docs/operations/plan/ssd/ssd_init.html) finally. So the way to prepare a used disk, per the Aerospike developers, is to do a full disk write. I decided to do a secure erase via the Linux nvme command instead, and that got rid of the old data. IDK which solution is worse for the SSD…

Old aerospike.conf:

namespace classifier {
        replication-factor 1
        memory-size 4G
        storage-engine memory
}

namespace classifier_ssd {
    memory-size 2G
    storage-engine device {
        device /dev/nvme2n1
        write-block-size 128K
    }
}

Data in the old classifier_ssd namespace:

aql> show sets
+------------------+------------------+---------+-------------------+----------------------+-------------------+--------------+------------+
| disable-eviction | ns               | objects | stop-writes-count | set                  | memory_data_bytes | truncate_lut | tombstones |
+------------------+------------------+---------+-------------------+----------------------+-------------------+--------------+------------+
| "false"          | "classifier"     | "0"     | "0"               | "classified_files"   | "0"               | "0"          | "0"        |
| "false"          | "classifier_ssd" | "5"     | "0"               | "trained_model_list" | "0"               | "0"          | "0"        |
| "false"          | "classifier_ssd" | "3"     | "0"               | "demo_set2"          | "0"               | "0"          | "0"        |
+------------------+--------------+---------+-------------------+----------------------+-------------------+--------------+------------+
[127.0.0.1:3000] 3 rows in set (0.001 secs)

OK

aql> select * from classifier_ssd.trained_model_list
+------------+-------------------+-------------+-------------+-------------+-------------+
| test-bin-1 | test-bin-2        | prediction1 | prediction2 | prediction3 | prediction4 |
+------------+-------------------+-------------+-------------+-------------+-------------+
| 3          | "3"               |             |             |             |             |
| 1          | "1"               |             |             |             |             |
| 1234       | "test-bin-2-data" | 0.85        | 0.09        | 0.01        | 0.005       |
| 2          | "2"               |             |             |             |             |
| 4          | "4"               |             |             |             |             |
+------------+-------------------+-------------+-------------+-------------+-------------+
5 rows in set (0.066 secs)

OK

New aerospike.conf:

namespace classifier {
        replication-factor 1
        memory-size 4G
        storage-engine memory
}

namespace ssd_backed {
    memory-size 2G
    default-ttl 0
    storage-engine device {
        device /dev/nvme2n1
        write-block-size 128K
    }
}

Data in the new ssd_backed namespace:

Note the objects count!!

aql> show sets
+------------------+--------------+---------+-------------------+----------------------+-------------------+--------------+------------+
| disable-eviction | ns           | objects | stop-writes-count | set                  | memory_data_bytes | truncate_lut | tombstones |
+------------------+--------------+---------+-------------------+----------------------+-------------------+--------------+------------+
| "false"          | "classifier" | "0"     | "0"               | "classified_files"   | "0"               | "0"          | "0"        |
| "false"          | "ssd_backed" | "5"     | "0"               | "trained_model_list" | "0"               | "0"          | "0"        |
| "false"          | "ssd_backed" | "3"     | "0"               | "demo_set2"          | "0"               | "0"          | "0"        |
+------------------+--------------+---------+-------------------+----------------------+-------------------+--------------+------------+
[127.0.0.1:3000] 3 rows in set (0.001 secs)

OK

aql> select * from ssd_backed.trained_model_list
+------------+-------------------+-------------+-------------+-------------+-------------+
| test-bin-1 | test-bin-2        | prediction1 | prediction2 | prediction3 | prediction4 |
+------------+-------------------+-------------+-------------+-------------+-------------+
| 3          | "3"               |             |             |             |             |
| 1          | "1"               |             |             |             |             |
| 1234       | "test-bin-2-data" | 0.85        | 0.09        | 0.01        | 0.005       |
| 2          | "2"               |             |             |             |             |
| 4          | "4"               |             |             |             |             |
+------------+-------------------+-------------+-------------+-------------+-------------+
5 rows in set (0.066 secs)

OK

Did you take a look at this article on blkdiscard?

Or this older one referring to the dd command?

I didn’t see the blkdiscard one. The one I noted suggests using dd. Blkdiscard seems a good way to go.