gpt4 book ai didi

inode - 读取 super block

转载 作者:行者123 更新时间:2023-12-04 21:01:10 27 4
gpt4 key购买 nike

我知道在 Unix(特别是 Mac OS X)中, super 块存储有关磁盘上数据布局的信息,包括 inode 开始和结束的磁盘地址。我想扫描程序中的 inode 列表以查找已删除的文件。如何找到 inode 开始的磁盘地址?我查看了 statfs 命令,但它没有提供此信息。

最佳答案

既然您提到了 Mac OS X,那么我们假设您的意思是仅针对 HFS+ 执行此操作。 Wikipedia page提供了一些关于可能的启动方式的信息,例如它说的是关于磁盘布局的:

Sectors 0 and 1 of the volume are HFS boot blocks. These are identical to the boot blocks in an HFS volume. They are part of the HFS wrapper.

Sector 2 contains the Volume Header equivalent to the Master Directory Block in an HFS volume. The Volume Header stores a wide variety of data about the volume itself, for example the size of allocation blocks, a timestamp that indicates when the volume was created or the location of other volume structures such as the Catalog File or Extent Overflow File. The Volume Header is always located in the same place.

The Allocation File which keeps track of which allocation blocks are free and which are in use. It is similar to the Volume Bitmap in HFS, each allocation block is represented by one bit. A zero means the block is free and a one means the block is in use. The main difference with the HFS Volume Bitmap, is that the Allocation File is stored as a regular file, it does not occupy a special reserved space near the beginning of the volume. The Allocation File can also change size and does not have to be stored contiguously within a volume.


之后就变得更复杂了。阅读 B* trees , 例如。
我不是 Mac OS 用户,但如果还没有编写用于扫描已删除文件的工具,也许有些是开源的并且可以提供更具体的起点,我会感到惊讶吗?

关于inode - 读取 super block ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/339795/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com