为什么必须多个文件系统“类型”存在?

发布于 2025-01-23 20:35:08 字数 196 浏览 3 评论 0原文

文件系统提供了一种在磁盘上分类(并因此导航)数据的机制。这对我来说很有意义。如果我想找到一些“组”数据,我不想自己记住字节偏移。我宁愿有一些可以动态导航的查找系统。

但是,我不明白为什么必须存在不同的文件系统。例如,为什么ntfs,fat16/32,ext?

为什么不同的操作系统(Linux,Windows等)应该依靠不同的方法来组织磁盘上的数据?

File systems provide a mechanism for categorizing (and thus navigating) data on a disk. This makes sense to me. If I want to find some "group" of data, I don't want to have to remember byte offsets myself. I would rather have some look up system that I can dynamically navigate.

However, I don't understand why different file systems must exist. For example, why NTFS, FAT16/32, EXT?

Why should different operating systems (Linux, Windows, etc.) rely on different methods for organizing data on disk?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

杀手六號 2025-01-30 20:35:08

我认为一个更合适的问题(以及您想回答的问题)是“为什么存在 do 存在多个文件系统?”。答案取决于特定的文件系统,但在许多情况下,它归结为三个原因的一个(或组合):

  • 解决现有文件系统中的某些类型的问题,或者
  • 由于意见差异或
  • 公司兴趣而 拆分。

胖家庭

原始的脂肪文件系统是在1970年代后期引入的。在许多方面,脂肪很棒:它的内存足迹较低且设计简单。 iirc,到这个日期,它仍然用于嵌入式系统中。

文件系统的脂肪家族包括原始的8位脂肪,Fat12,Fat16和Fat32。 (还有其他几个版本,但它们与此答案无关。)每个版本的胖文件系统之间都有几个功能差异,其中一些展示了创建新版本的动机。例如,从8位脂肪转移到fat12:

  • 最大文件名长度从9个字符增加到11或255个字符,从6.3文件名编码转换为 8.3编码或LFN扩展名。
  • 添加了对子目录的支持。
  • 文件尺寸粒度从128个字节减少到1个字节。

这些功能都不是单独的,可能是创建FAT12的动机,但是这些功能共同赢得了8位脂肪的明显胜利。请参阅 fat wikipedia page ,以获取更完整的差异列表。

NTF

在讨论NTF之前,我们应该研究其前身:HPFS。脂肪的简单设计被证明是一个问题:它限制了脂肪所能提供的功能以及其性能。 HPF的创建是为了解决脂肪的缺点。

  • 支持混合案例文件名,在不同的代码页面
  • 更有效地使用磁盘空间(文件不是使用多部门群集存储,而是以每部门为基础存储)
  • 一种内部体系结构,使相关项目在磁盘卷上彼此紧密
  • 单独的Datestamps用于上次修改,上次访问和创建(与当时的脂肪实现中的最后一次建模的Datestamp相反)
  • 根目录位于中点,而不是在磁盘的开头,以更快的平均访问

位于 应该足够强迫地证明为什么创建了HPF,但是NTF如何适应图片? HPFS是Microsoft和IBM的联合项目。 由于意见上的几个差异,他们分开了,Microsoft创建了NTF。这是创建新文件系统的另一个原因:意见差异。这没有天生的错误,但是它确实具有偶尔分裂项目的副作用。

大家庭

与NTF一样,我们需要检查Ext的前身,以了解其为何创建。 EXT的前身是Minix文件系统。 Minix是为了教学目的而创建的,因此它很简单,并阐明了UNIX文件系统提供的几个复杂功能。 Linux支持的第一个文件系统是Minix文件系统。 minix文件系统的简单性很快就成为一个问题

minix限制了文件名的长度为14个字符(以后版本中的30个字符),将分区限制在64个兆字节上,并且文件系统是为教学目的而不是性能的。

因此,创建了扩展的文件系统(即ext)来解决Minix文件系统的缺点。

在类似的徒劳中,创建了EXT2来解决Ext的缺点,依此类推。例如,Ext2添加了三个单独的时间戳(ATIME,CTIME和MTIME),EXT3添加日记帐和Ext4扩展存储限制。这些都是打破的更改,需要“新”文件系统。它们并不是版本之间唯一的更改,但是这些更改表明了为什么需要创建另一个文件系统。

为什么不同的操作系统使用不同的文件系统?

今天,几个文件系统已被广泛使用。 Apple设备上的Apple File System(APF),Windows设备上的NTF以及Linux上的几个不同的文件系统。为什么不同的操作系统使用不同的文件系统?对于Linux,原因很明显:Linux需要开源文件系统。这就是为什么它最初使用minix文件系统的原因。

对于Windows和Apple设备,不同的是,我们应该说,政治。 Microsoft创建了NTF来解决其认为重要的问题,Apple创建了APF来解决其认为重要的问题。商业操作系统供应商还创建了自己的文件系统来差异化。

Linux为什么使用几个不同的文件系统?

我们可以看到为什么不同的OSS使用不同的文件系统,但是仅在Linux上积极使用几个文件系统,例如。 EXT4,BTRFS,ZFS,XFS和F2FS。什么给?

Linux是一个不同的环境。 Linux内核源公开可用,可以由任何用户修改,启动和测试。因此,如果一个文件系统不支持您想要的功能或提供所需的性能,则可以创建一个新的文件系统(当然,说起来容易做起来难)。例如,

  • BTRF解决了Ext3/4上缺乏快照。
  • ZFS是为Solaris操作系统创建的,但后来移植到Linux。 (ZFS也具有非常丰富的功能。)
  • XFS的创建是通过使用不同的基础数据结构(即B-Trees)来提高性能。
  • F2FS的创建是为了解决固态媒体上的性能。与旋转磁盘相比,SSD提供较低的延迟和更大的吞吐量。事实证明,使用更快的磁盘并不需要等同于更好的文件系统性能。

I think a more appropriate question (and the question you'd like answered) is "Why do multiple file systems exist?". The answer depends on the particular file system, but in many cases it comes down to one (or a mix of) of three reasons:

  • addressing some type of issue in existing file systems, or
  • a split due to difference in opinion, or
  • corporate interests.

The FAT family

The original FAT file system was introduced in the late 1970s. In many ways, FAT is great: it has a low memory footprint, and simple design. IIRC, it's still used in embedded systems to this date.

The FAT family of file systems comprises of the original 8-bit FAT, FAT12, FAT16, and FAT32. (There are several other versions, but they're not relevant to this answer.) There were several feature-differences between each version of the FAT file systems, some of which demonstrate the motivation for creating a new version. For example, in moving from 8-bit FAT to FAT12:

  • the maximum filename length increased from 9 characters to 11 or 255 characters by switching from 6.3 filename encoding to 8.3 filename encoding or LFN extensions, respectively.
  • support for subdirectories was added.
  • file size granularity decreased from 128 bytes to 1 byte.

None of these features individually were likely the motivation for the creation of FAT12, but together these features are a clear win over 8-bit FAT. Refer to the FAT Wikipedia page for a more complete list of differences.

NTFS

Before discussing NTFS, we should look at its predecessor: HPFS. The simple design of FAT turned out to be a problem: it constrained what features FAT could offer, and how it performed. HPFS was created to address the shortcomings of FAT. For example, HPFS provide several features FAT could not:

  • Support for mixed case file names, in different code pages
  • More efficient use of disk space (files are not stored using multiple-sector clusters but on a per-sector basis)
  • An internal architecture that keeps related items close to each other on the disk volume
  • Separate datestamps for last modification, last access, and creation (as opposed to last-modification-only datestamp in then-times implementations of FAT)
  • Root directory located at the midpoint, rather than at the beginning of the disk, for faster average access

That should be compelling enough to demonstrate why HPFS was created, but how does NTFS fit into the picture? HPFS was a joint project by Microsoft and IBM. Due to several differences in opinion, they separated, and Microsoft created NTFS. This is another reason new file systems are created: difference in opinion. There's nothing inherently wrong with this, but it does have the side effect of occasionally fragmenting projects.

The extended family

As with NTFS, we need to examine the predecessor of ext to understand why it was created. The predecessor of ext is the MINIX file system. MINIX was created for teaching purposes, so it was simple and elided several complex features the UNIX file system offered. The first file system supported by Linux was the MINIX filesystem. The simplicity of the MINIX file system soon became an issue:

MINIX restricted filename lengths to 14 characters (30 in later versions), it limited partitions to 64 megabytes, and the file system was designed for teaching purposes, not performance.

And thus, the extended file system (ie. ext) was created to address the shortcomings of the MINIX file system.

In a similar vain, ext2 was created to address the shortcomings of ext, and so on. For example, ext2 added three separate timestamps (atime, ctime, and mtime), ext3 adding journaling, and ext4 extended storage limits. These were all breaking changes which required a "new" file system. They weren't the only changes between versions, but these changes demonstrate why creating another file system was necessary.

Why do different operating systems use different file systems?

Several file systems are widely used today. Apple File System (APFS) on Apple devices, NTFS on Windows devices, and several different file systems on Linux. Why do different operating systems use different file systems? For Linux, the reason is obvious: Linux needed an open source file system. That's why it initially used the MINIX file system.

For Windows and Apple devices, the difference is more, shall we say, political. Microsoft created NTFS to address the issues it thought were important, and Apple created APFS to address the issues it thought were important. Commercial OS vendors also create their own file systems for product differentiation.

Why does Linux use several different file systems?

We can kinda see why different OSs use different file systems, but several file systems are actively in use on Linux alone, eg. ext4, Btrfs, ZFS, XFS, and F2FS. What gives?

Linux is a different environment. The Linux kernel source is openly available, and can be modified, booted, and tested by any user. So, if one file system does not support the features you want, or offer the performance you need, you can create a new file system (which is, of course, easier said than done). For example,

  • Btrfs addressed (among other things) the lack of snapshots on ext3/4.
  • ZFS was created for the Solaris operating system, but later ported to Linux. (ZFS also has a very rich set of features.)
  • XFS was created to improve performance by using different underlying data structures (ie. B-trees).
  • F2FS was created to address performance on solid state media. SSDs offer lower latency, and greater throughput compared to spinning disks. It turns out simply using a faster disk does not necessary equate to better file system performance.
不一样的天空 2025-01-30 20:35:08

不同的操作系统使用不同的FS,因为每个OS都有不同的哲学和不同的目标。

例如,Windows使用NTF,因为它们需要安全且智能的FS(没有快速或小的哲学)

Ubuntu(大多数现代分布)使用Ext4(也支持其他分布)(也支持他人),主要是因为它简单而速度。

different OS uses different FS Because each of them has a different philosophy and different goals.

For example windows use ntfs because they want secure and smart FS (without have philosophy like fast or small)

Ubuntu (with most modern distributions) use ext4 (And also supports others) Mostly because its simple and speed.

半世晨晓 2025-01-30 20:35:08

我不认为这是技术性的,它只是不同的公司同时在同一时间工作,加上某些OSS(例如Windows和Mac)的封闭源性质,这使得其他公司很难复制完整的功能和非法来反向工程师,这就像为什么首先是不同的OSS。

I don't think it's something technical, it's just different companies worked on the same thing at the same time plus the closed source nature of some OSs like windows and mac which make it hard for other companies to replicate the full functionality and illegal to reverse engineer it, it's like why different OSs in the first place.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文