文件在磁盘上是如何表示的

发布于 2024-09-28 09:18:51 字数 212 浏览 5 评论 0原文

所以我想问,如果这是显而易见的,或者新手问题,请原谅我: 如果我创建一个文件,比如说一个文本文件 - 保存它,(我使用的是 Ubuntu),所以我创建的这个文件有一些与之相关的额外信息,例如,它在我的硬盘上的位置已保存。如何检查这些信息?我的特定文件的此信息存储在哪里?如何检查存储在磁盘上的文件,我假设以什么字节为单位?

也许我需要关注这个问题,

谢谢,

B

so I want to ask, and forgive me if this is obvious, or newbie question:
if I create a file, say a text file - save it, (I'm using Ubuntu), so this file I have created, has some extra information associated with it, such as, the place on my hard drive where it has been saved. How to examine this information? Where does this information get stored for my specific file? How to examine the file as it is stored on my disk, I assume in terms of, what, bytes?

Maybe I need to focus this question,

Thanks,

B

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

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

发布评论

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

评论(2

森林迷了鹿 2024-10-05 09:18:51

这是您的文件系统的责任。简而言之,文件系统是一种分布在整个磁盘上的数据结构(这就是“格式化”磁盘的作用),并且您的文件将保存到该数据结构中。文件系统有很多,它们的细节差异很大。 http://www.forensics.nl/filesystems 有一大堆关于文件系统设计和组织的论文。我将从 McKusick 的 A Fast File System for UNIX 开始;它很古老,但其中包含的许多思想至今仍然具有影响力。

如果您想查看磁盘上的数据结构,您需要一个特定于文件系统的取证工具。 Ubuntu 可能使用 ext2 系列中的某些内容,因此请尝试 debugfs

This is the responsibility of your file system. In very brief, a file system is a data structure which is laid out onto your entire disk -- that's what "formatting" a disk does -- and your files are saved into that data structure. There are lots of file systems, and their details vary quite widely. http://www.forensics.nl/filesystems has a whole bunch of papers on file system design and organization. I'd start with McKusick's A Fast File System for UNIX; it's old, but it contains lots of ideas that are still influential today.

You need a filesystem-specific forensics tool if you want to look at the data structures on your disks. Ubuntu's probably using something in the ext2 family, so try debugfs.

So要识趣 2024-10-05 09:18:51

我想也许您确实需要稍微关注一下:-)

对于 UNIX 文件系统,有许多不同的类型。

我最熟悉的(ext2)在磁盘上有一个包含目录条目的“文件”。这些条目是简单的名称和指向文件本身的指针(这就是为什么您可以有多个目录条目指向同一个文件,硬链接)。

文件本身是一个inode,其中包含文件的属性(所有者、大小、权限等)。

inode 还包含指向文件内容的直接和间接指针。我所说的直接指的是指向数据块的指针。

间接指针是指向内容指针的指针。我相信您可以转到另外两个间接级别,这会给您带来真正巨大的文件大小:

alt text

更多详细信息 < a href="http://en.wikipedia.org/wiki/Ext2fs" rel="nofollow noreferrer">维基百科。

I think maybe you do need to focus it a bit :-)

For UNIX file systems, there are many different types.

The one I'm most familiar with (ext2) has a "file" on disk containing directory entries. These entries are simple names and pointers to the file itself (which is why you can have multiple directory entries pointing to the same file, hard links).

The file itself is an inode which contains the properties of the file (owner, size, permissions and so on).

The inode also contains direct and indirect pointers to the contents of the file. By direct, I mean a pointer to a data block.

An indirect pointer is a pointer to a pointer to contents. I believe you can go to another two levels of indirection, which gives you truly massive file sizes:

alt text

More details on Wikipedia.

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