NTFS 备用数据流 - 好主意还是坏主意? [英] NTFS Alternate Data Streams - Good or bad Idea?

查看:31
本文介绍了NTFS 备用数据流 - 好主意还是坏主意?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为文件存储一些与应用程序相关的元数据,而 NTFS 备用数据流 (AltDS) 允许我将这些元数据直接存储在文件中,而不是单独的数据库中.

I would like to store some Application-Related Metadata for Files, and NTFS Alternate Data Streams (AltDS) would allow me to store this metadata directly on the files rather than in a separate database.

我只是觉得这不是个好主意.我知道这只适用于 NTFS,但至少如果用户将文件复制/移动到非 NTFS 驱动器,他们会收到来自 Windows 的警告(是的,是的,没有人阅读警告,我知道)-

I just don't feel like this is a good idea. I know that this only works on NTFS, but at least if the user copies/moves the files to a Non-NTFS drive they get a Warning from Windows (yeah, yeah, no one reads warnings, I know)-

而且,在文件中存储额外数据会变得非常浪费,因为即使我的应用程序被卸载,AltDS 也会保留.就像十年前,人们在卸载程序后使用注册表清理器"从注册表中删除无用的条目,以提高系统运行速度(如果清理器清理得太多,系统会变得更不稳定……).

But also, storing additional data on a file can become very wasteful, as the AltDS stay even if my Application is uninstalled. It's like a decade ago when people used "Registry Cleaners" to remove useless entries from the registry after uninstalling a program to make their system run faster (and less stable when the cleaner cleaned too much...).

我只是想知道它们可以合理地用来做什么?它们是否应该完全留给 Microsoft Apps 使用?或者是否有某种通用政策,哪些类型的应用可以使用它们(恶意软件除外)?

I just wonder what they can be reasonably used for? Should they be completely left for Microsoft Apps to use? Or is there some sort of common policy what types of apps may use them (apart from malware)?

只是为了澄清的想法.我正处于为自己编写小型文档管理系统的早期阶段.因为我想要自由移动文件,所以我想将元数据存储在文件上,这样如果我移动/重命名/修改它们,我的应用程序仍然可以识别它们.它可以是整个元数据,也可以只是一个用于单独数据库的 GUID.

Just to clarify what my idea was. I'm in the early stages of writing a small document management system for myself. Because I want to have the freedom to move files around, I want to store metadata on the file so that if I move/rename/modify them, my app still recognizes them. It could either be the entire Metadata or just a GUID that works with a separate database.

总结给出的要点:

优点:

  • 元数据随文件移动,因此无需通过散列或文件名来识别它
  • 适用于所有文件类型,甚至是无法在文件本身中存储任何数据的 .txt 文件

缺点:

  • 仅适用于 NTFS,它可能不是未来 Windows 版本中的默认文件系统
    • 尽管如果他们将 WinFS 放在一起,如果 MS 不会自动转换它们,我会感到惊讶
    • 大多数 USB 记忆棒是 FAT32.许多私有文件服务器都是 Linux.从互联网下载文件应该只传输文件而不是流.简而言之:失去它们很容易.

    推荐答案

    如果没有关于您存储的数据类型的更多信息,很难说.您似乎意识到使用它们的一些问题,所以我不确定我能提供多少帮助.不过,这是我对备用数据流的一般想法:

    It's hard to say without more information about the kind of data you're storing. You seem to be aware of some of the concerns involving their use, so I'm not sure how much I can help. Here's my general thoughts on alternate data streams, though:

    首先,正如您所指出的,AD 流仅适用于 NTFS.如果有可能需要将此元数据存储在 FAT 文件系统上,则需要某种回退机制.现代 PC 可能具有 NTFS 格式的内部硬盘驱动器,但您遇到的大多数 USB 闪存驱动器仍然是 FAT 格式的.如果您的用户将数据文件存储在闪存驱动器上,请记住这一点.

    First of all, as you've noted, AD streams only work on NTFS. If there's any chance you'll need to store this metadata on a FAT filesystem, you'll need some kind of fallback mechanism. Modern PCs will probably have NTFS-formatted internal hard drives, but most USB flash drives you encounter are still FAT-formatted. Keep that in mind if your users will be storing data files on flash drives.

    除此之外,我想不出任何避免 AD 流的技术原因,但我仍然对使用它们持谨慎态度.无论意图如何,人们往往对向他们隐藏"数据的应用程序感到紧张.考虑一下 Sony Rootkit 惨败,等等.我并不是说您的应用程序差得如此糟糕,但人们(尤其是不太懂技术的人)可能无法区分.不过,我会允许它们可能对您的应用程序有效.当然,卸载后留下AD流的问题仍然很现实.您可能需要考虑让运行卸载程序的人选择运行程序来搜索他们的驱动器并清理所有剩余的流.

    Aside from that, I can't think of any technological reasons to avoid AD streams, but I'd still be wary of using them. People tend to be nervous about applications that "hide" data from them, regardless of the intent. Consider the Sony rootkit fiasco, and so on. I'm not saying your application is anywhere near as bad as that, but people (especially the less tech-savvy) may not make out the distinction. Still, I will allow that they might have a valid use for your application. The problem of leaving the AD streams behind after uninstallation is still very real, of course. You might want to consider giving people running the uninstaller the option of running a program to search their drive(s) and clean up any remaining streams.

    另外,请记住KISS 原则.使用 AD 流真的是有效解决应用程序元数据存储问题的最简单方法吗?如果是这样,也许 AD 流是个好主意,但如果不是,我会认真考虑采用另一种方法.

    Also, remember the KISS principle. Is the use of AD streams really the simplest way to effectively solve your application's metadata storage problem? If so, maybe AD streams are a good idea, but, if not, I'd seriously consider taking another approach.

    这篇关于NTFS 备用数据流 - 好主意还是坏主意?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆