I've been spending some time working with self encrypting SSDs recently, and I am stuck on how to access drive contents after I've unlocked it.

Normally with this drive, you would load a Preboot Authentication image on startup that would unlock a partition containing the OS, and you would see the unlocked partition in /dev when the OS boots. However, I'm using the drive for secondary storage, and would like to be able to unlock it after the OS boots. Here's the behavior I'm looking to achieve:

  1. /dev/nvme0 is present in the /dev directory, but you can't see any partitions because it's locked. Exactly what I'd expect!
  2. Issue TCG Opal commands to unlock the drive. Confirm that the drive is unlocked using TCG Identify command. Success!
  3. ??? <----- This is where I'm stuck
  4. /dev/nvme0n1p* for each partition on the drive is present in /dev

What do I need to do for step 3 in order to force a reread of the device so that I can see the partition after it's unlocked? And is this something I can do programmatically, or would I have to invoke a script of some sort?


I don't have self-encrypting NVMe disks that I could test these commands with. But based on how SAN LUN partitions can be rescanned, at least one of these ways might work:

echo 1 > /sys/class/nvme/nvme0/rescan_controller


partprobe /dev/nvme0n1
sudo blockdev --rereadpt -v /dev/nvme0n1

I also use this script,

#! /bin/bash

test ! -d "$SCSI" && echo "Error: cannot find the $SCSI directory." && exit 1
cd "$SCSI" || exit 1

for i in *; do
    echo -n "Scanning $i ..."
    echo "- - -" > $i/scan && echo " done."

echo "Finished. Consult with 'dmesg' for details."

Must be run under root/sudo.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.