我的 SSD 的 DRAT 字是什么?

信息安全 取证 数据恢复 固态硬盘
2021-08-17 06:01:05

forensicfocus.com 上的这篇文章说以下关于 TRIM 后的确定性读取(强调我的):

因此,支持 DRAT 而不是 DZAT 的 SSD 驱动器返回的数据可以是全零或其他数据字,也可以是存储在该逻辑页面中的原始预修剪数据。

这句话听起来像是可以通过简单地询问 SSD 控制器来恢复某些 SSD 上的修剪数据。

hdparm告诉我我的 SSD(SanDisk SSD PLUS 1000GB)启用了 DRAT:

Data Set Management TRIM supported (limit 8 blocks)
Deterministic read data after TRIM

我想找出 SSD 确定性地为修剪数据返回哪个单词。

1个回答

DRAT 字似乎是零

我通过以下实验得出结论,所讨论的 SSD 的 DRAT 字为零:

  1. 创建一个小文件并获取其文件内容的块号。
  2. 删除文件。
  3. 运行fstrim以将 TRIM 命令发送到 SSD 的控制器。我的操作系统(Arch Linux 5.12.9)不会自动修剪 SSD,请在此处讨论。
  4. 使用以下命令读取已删除文件块的内容debugfs:全为零。

这是执行这些步骤的脚本:

#!/bin/sh

file=test_file
echo "Current date: $(date)" > "$file"; sync
# Get the device of our test file, for example "/dev/sda1"
device=$(df -P "$file" | awk 'END{print $1}')
# The block of the file's contents, stat gets the inode number
block=$(sudo debugfs -R "blocks <$(stat -c %i "$file")>" "$device")
# fstrim needs the mountpoint of the file system, e.g. "/"
mountpoint=$(stat -c %m "$file")
rm $file; sync
# Send TRIM to make the SSD delete unused blocks. Might take a while
sudo fstrim "$mountpoint"
# Read the contents of the deleted file, -D bypasses the buffer cache
sudo debugfs -D -R "block_dump $block" "$device"