Volume shadow copies, ReFS, etc

ReFS

Been thinking of trying ReFS lately. ReFs, which is short for Resilient File System, is the next gen file system from Microsoft. I want to try it because I am curious, but also because it has some neat features like integrity checks and such. It’s similar to ZFS and btrfs.

Integrity checks are useful when it comes to preventing bitrot. I have many external hard-disks at home and I take regular backups, but file systems like NTFS have no way of checksumming the files to ensure they are not corrupted over time. It’s quite possible my master hard-disk has some corrupt files and unknown to me the corrupted files are now copied to all the backups. ReFS, ZFS, btrfs are next-gen file systems that can prevent such problems.

ReFS is designed to work with Storage Spaces. Using Storage Spaces you can combine multiples disks into a pool and create partitions from this pool with various levels of resiliency (such as two disk mirror, three disk mirror, parity).

storage space

Storage Spaces works with both NTFS and ReFS but when clubbed with ReFS you can leverage the integrity check feature to automatically repair corrupted files. ReFS by default can detect file corruptions, but it a file is corrupt it has no way of replacing it with a non-corrupt version. However if ReFS is used with Storage Spaces in a two disk mirror (for instance) ReFS has two copies of the file and it can replace the corrupt version on one disk with a good version from the other disk.

ReFS is available on Windows Server 2012 and Windows 8 (and above). On Windows Server 2012 it is more “exposed” as in one can format a partition as ReFS from disk management itself.

format-refs

But on Windows 8 the ReFS option is not available.

format-norefs

To work around this one has to trick Windows 8 into thinking it’s in the MiniNT mode. Thanks to this post:

  1. Open Registry editor and navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control
  2. Create a new key called MiniNT
  3. Create a new DWORD value called AllowRefsFormatOverNonmirrorVolume and set its value to 1

Now disk management will give the option of ReFS.

It’s also possible to use the format command to create a ReFS file system. Advantage of using the format command is that you can turn on integrity checks. By default integrity checks are only turned on automatically if the underlying volume is on a mirrored space (as that’s the only time corrupted files can be recovered), but in case you want to turn it on anyways (and see alerts in event viewer in case of any corruptions) the format has an /i:enable switch to turn this on.

cmdprompt

Once the ReFS file system is created delete the MiniNT key created above.

It’s worth pointing out that without the MiniNT hack the format command too will throw an error:

ReFS file system is not supported on this device.
Format failed.

As I said earlier, while ReFS can be used without storage spaces it’s better to use it with Storage Spaces. If you go down that route there’s no need to do the MiniNT hack above. When creating a new storage space volume even Windows 8 gives the option to use ReFS.

Snapshots

Another thing I wanted to try was snapshots. Snapshots isn’t an NTFS, ReFS, or Storage Space specific feature. It’s been there since Windows XP and Windows 2003 with NTFS partitions but it isn’t exposed much on client OSes. Snapshots work with ReFS too.

On Windows Server snapshots are taken at regular intervals and it’s possible to expose these snapshots for shared volumes – so clients can view previous snapshots. Windows 7 exposed snapshots by way of the “Previous Version” tab in a folder properties but Windows 8 does away with this and uses “File History” instead (which is not really snapshots, it’s more like Apple’s Time Machine backup). Windows 8 still has snapshots just that it’s not exposed like this and there’s no way to configure it.

It is possible to create snapshots using the Win32_ShadowCopy class. It is possible to access snapshots via symbolic links. This link has example code to create a snapshot using PowerShell and “mount” it to a symbolic link. I will be using something along those lines to take backups of my ReFS partitions (once I move over to ReFS that is, so far I haven’t moved over my data to ReFS as there’s no way to upgrade a partition and I don’t have enough free space to move my existing files elsewhere!).