简体   繁体   English

NTFS在哪里存储文件属性

[英]where does NTFS stores file attributes

I'm currently developing a file system and doing some research on existing ones, and in the file system I have in mind I would like to add extra metadata (or file attributes) to files besides the ones generally stored by FS's like NTFS that stores for each file its filename, type, path, size, date of creation and modification, and the proprietary. 我目前正在开发文件系统,并对现有文件系统进行一些研究,在此文件系统中,我想除文件通常由FS所存储的文件(例如NTFS)外,还要向文件添加额外的元数据(或文件属性)对于每个文件,其文件名,类型,路径,大小,创建和修改的日期以及专有文件。

In NTFS in particular I found that the $MFT stores for each file attributes like the file's name in $FILENAME and its timestamps in $STANDARD_INFORMATION, but what about the rest of its attributes like its owner, location, size and type? 特别是在NTFS中,我发现$ MFT为每个文件存储属性,例如$ FILENAME中的文件名和$ STANDARD_INFORMATION中的时间戳,但是其余的属性(如所有者,位置,大小和类型)如何呢?

I just ask this in order to understand if its possible to complement a FS like NTFS with extra metadata about files, like I said before, but I can't seem to understand where it stores the metadata it already has... 我只是问这个问题,以了解是否有可能像我之前所说的那样,用有关文件的额外元数据来补充像NTFS这样的FS,但是我似乎无法理解它在哪里存储它已经拥有的元数据...

The owner can be determined via the $SECURITY_DESCRIPTOR attribute. 可以通过$ SECURITY_DESCRIPTOR属性确定所有者。 The location, I believe you mean path on the volume, can only be determined by parsing directories until you come across that particular file (the INDX blocks that make up the B*-Trees of the filesystem store references to file records in the MFT). 我相信您的意思是卷上的路径,只能通过解析目录来确定,直到遇到特定文件为止(构成文件系统B * -Tree的INDX块在MFT中存储对文件记录的引用) 。 File size can be determined accurately from the $DATA attribute. 可以从$ DATA属性中准确确定文件大小。

The file type can only be determined either from the file's content (certain file formats have markers) or from the extension contained in the file name. 只能根据文件的内容(某些文件格式带有标记)或文件名中包含的扩展名确定文件类型。 The file system is agnostic when it comes to file types. 当涉及文件类型时,文件系统是不可知的。 If you were referring to file types as in files, directories, links etc, these can be determined from the file record itself. 如果您在文件,目录,链接等中引用文件类型,则可以从文件记录本身确定这些类型。

As for adding extra metadata it would be unwise to add additional attributes that the NTFS driver doesn't recognize since you would have to write your own proprietary driver and distribute it. 至于添加额外的元数据,添加NTFS驱动程序无法识别的其他属性是不明智的,因为您必须编写自己的专有驱动程序并进行分发。 Machines that do not have that driver will see the drive as corrupt. 没有该驱动程序的计算机将看到该驱动器已损坏。 You should also consider what happens when the attributes take more than the size of the file record (which is fixed in newer versions of NTFS and it's 1024 bytes, unlike old versions where the size of a record may vary). 您还应该考虑当属性占用的文件大小超过文件记录的大小时会发生什么(在新版本的NTFS中是固定的,它是1024字节,这与记录大小可能有所变化的旧版本不同)。

A good idea to solve this problem and make the file system available to users that don't have your software or driver installed is to add named streams. 解决此问题并使文件系统可用于未安装软件或驱动程序的用户的一个好主意是添加命名流。 You could use your own naming convention and store whatever you like and the NTFS driver will take care of the records for you even if they get outside the 1024 limit. 您可以使用自己的命名约定并存储所需的任何内容,即使记录超出1024的限制,NTFS驱动程序也会为您处理这些记录。 The users that do not have the software installed can view that file system and won't know that those named streams exist since applications typically open the unnamed stream passed by the NTFS driver by default (unless otherwise specified). 未安装软件的用户可以查看该文件系统,并且不会知道这些命名流的存在,因为默认情况下,应用程序通常会打开NTFS驱动程序传递的未命名流(除非另有指定)。

This link may give answers to your question. 链接可能会回答您的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM