Experience with Resolving a ReFS Volume Becoming RAW

起因

之前听闻REFS文件系统对NVME和SMR HDD有特别的优化,而且数据安全更好,是未来代替NTFS的文件系统。
所以一年前的时候把两个分区格式化成REFS来试试水。确实效果不错,除了OneDrive没法在REFS分区上用以外。

前几天突然内置的SMR HDD在系统更新之后变成了RAW分区。一开始是尝试在文件浏览器里面打开,显示参数错误。后来磁盘管理里显示RAW分区。
一开始以为是系统更新的问题,但是发现另一个REFS分区可以打开,突发奇想去事件管理器里一看,发现原来分区挂了。
无法打开

然后接着发现电脑很卡,在任务管理器里面看到那个已经挂的磁盘占用率持续90%+的读写,很好奇在干嘛,然后发现事件管理器里面提示这个。

自动修复不成功
无法纠正

那就只能去整数据恢复了。一开始我打算用R-Studio。
但是发现虽然REFS分区现在可以用R-Studio,但是REFS文件系统在快速迭代,那个软件更新速度赶不上微软的更新速度。所以我用那个软件恢复出来的文件是没有文件目录结构的。最后还是用微软自己家的数据恢复工具refsutil。

REFS数据打捞工具refsutil

什么是refsutil

用于诊断严重损坏的 ReFS 卷(变成RAW)、识别剩余文件,并将这些文件复制到另一个卷。
该工具位于 %SystemRoot%\Windows\System32 文件夹中。
除非卷为 RAW,否则不必使用 ReFSutil 工具。 如果为只读,则仍可访问数据。

Microsoft对refsutil的介绍

怎么用

ReFS Salvage 有两个阶段:扫描阶段和复制阶段。 在自动模式下,扫描阶段和复制阶段将按顺序运行。 在手动模式下,每个阶段都可以单独运行。 进度和日志保存在工作目录中,以允许单独运行阶段以及暂停和恢复扫描阶段。

1.确定为什么不能挂载
2.快速扫描阶段
3.完全扫描阶段
4.查看交互式控制台(因为可以看看哪些不需要的,然后在txt文件里删掉)
5.使用列表的复制阶段,把选择的文件复制出来

确定目标卷是否为refs卷,并确定该卷是否可装载。 如果卷不可装载,则会提供原因。
诊断扫描

快速扫描阶段

完全扫描阶段

后期的思路

启动REFS的完整性流功能

启动完整性流可能有帮助,完整性流是REFS的一项可选功能,保证获得数据是原始未出错。

完整性流是 ReFS 中的可选功能,它使用校验和来验证和维护数据完整性。虽然 ReFS 始终对元数据使用校验和,但默认情况下,ReFS 不会为文件数据生成或验证校验和。 完整性流是一项可选功能,允许用户对文件数据使用校验和。 启用完整性流后,ReFS 可以清楚地确定数据是否有效或已损坏。 此外,ReFS 和存储空间可以共同自动地更正损坏的元数据和数据。

!!!对性能有负面影响哦!!!

1
2
3
4
5
6
7
8
Get-Item -Path 'C:\*' | Set-FileIntegrity -Enable $True
Set-FileIntegrity C:\ -Enable $True

Get-Item -Path 'C:\*' | Set-FileIntegrity -Enable $False
Set-FileIntegrity C:\ -Enable $False

Get-Item -Path 'C:\*' | Get-FileIntegrity
Get-Item -Path 'C:\' | Get-FileIntegrity

使用软RAID阵列

使用VHDX的虚拟硬盘,并且使用Windows的存储池功能,构造软RAID1。分布在两个硬盘上提升可靠性。

Cause

Previously, I heard that the ReFS file system has special optimizations for NVME and SMR HDD, offers better data security, and is the future file system to replace NTFS.
So, a year ago, I formatted two partitions as ReFS to give it a try. It indeed performed well, except that OneDrive couldn’t be used on the ReFS partition.

A few days ago, the built-in SMR HDD suddenly became a RAW partition after a system update. At first, I tried opening it in File Explorer, which displayed a parameter error. Later, Disk Management showed it as a RAW partition.
Initially, I thought it was a system update issue, but I found the other ReFS partition could still be opened. On a whim, I checked the Event Viewer and discovered that the partition had failed.
Cannot open

Then I noticed the computer was very laggy. In Task Manager, I saw the failed disk had sustained read/write usage above 90%, and I was curious about what was happening. Checking the Event Viewer revealed this.

Automatic repair unsuccessful
Cannot correct

So, the only option was data recovery. Initially, I planned to use R-Studio.
However, although ReFS partitions are now supported by R-Studio, the ReFS file system is rapidly evolving, and the software update speed can’t keep up with Microsoft’s updates. As a result, the files I recovered with that software lacked directory structures. In the end, I used Microsoft’s own data recovery tool, refsutil.

The ReFS Data Recovery Tool refsutil

What is refsutil?

Used for diagnosing severely corrupted ReFS volumes (turned RAW), identifying remaining files, and copying those files to another volume.
The tool is located in the %SystemRoot%\Windows\System32 folder.
Unless the volume is RAW, you don’t need to use the ReFSutil tool. If it is read-only, data can still be accessed.

Microsoft’s introduction to refsutil

How to use

ReFS Salvage has two phases: the scan phase and the copy phase. In automatic mode, the scan phase and copy phase run sequentially. In manual mode, each phase can be run individually. Progress and logs are saved in the working directory to allow running phases separately, as well as pausing and resuming the scan phase.

  1. Determine why it cannot be mounted
  2. Quick scan phase
  3. Full scan phase
  4. View the interactive console (to see which files are unnecessary and delete them from the txt file)
  5. Copy phase using the list to copy selected files out

Determine if the target volume is a ReFS volume and whether it can be mounted. If the volume cannot be mounted, the reason is provided.
Diagnostic scan

Quick scan phase

Full scan phase

Post-recovery considerations

Enable ReFS Integrity Streams feature

Enabling integrity streams may help. Integrity streams are an optional feature in ReFS that ensures data remains unaltered and correct.

Integrity streams are an optional feature in ReFS that uses checksums to verify and maintain data integrity. While ReFS always uses checksums for metadata, by default, ReFS does not generate or verify checksums for file data. Integrity streams are an optional feature that allows users to use checksums for file data. When integrity streams are enabled, ReFS can clearly determine whether data is valid or corrupted. Additionally, ReFS and Storage Spaces can work together to automatically correct corrupted metadata and data.

!!! Negative impact on performance !!!

1
2
3
4
5
6
7
8
Get-Item -Path 'C:\*' | Set-FileIntegrity -Enable $True
Set-FileIntegrity C:\ -Enable $True

Get-Item -Path 'C:\*' | Set-FileIntegrity -Enable $False
Set-FileIntegrity C:\ -Enable $False

Get-Item -Path 'C:\*' | Get-FileIntegrity
Get-Item -Path 'C:\' | Get-FileIntegrity

Using software RAID arrays

Using VHDX virtual hard disks along with Windows’ Storage Spaces feature to create a software RAID1 setup distributed across two hard drives for improved reliability.


Experience with Resolving a ReFS Volume Becoming RAW
https://tokisaki.top/blog/refs-salvage-experience/
作者
Tokisaki Galaxy
发布于
2023年10月16日
许可协议