从 ext3 文件系统读取块?
在块级别访问 ext3 文件系统的最简单方法是什么?我不关心文件或原始字节,我只需一次读取 FS 一个块。有没有一种简单的方法可以做到这一点(用C语言)?或者也许是一个简单的应用程序,我可以从其来源中寻找灵感?我在网上没有找到可用的教程,而且我有点害怕深入内核源代码来了解如何做到这一点。
What's the easiest way to access an ext3 file system at the block level? I don't care for the files, or raw bytes, I just have to read the FS one block at a time. Is there a simple way to do this (in C)? Or maybe a simple app whose source I could look into for inspiration? I found no usable tutorials on the net, and I'm a bit scared to dive into the kernel source to find out how to do it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您想要一个简单的应用程序,那么我建议您可以看看“dd”实用程序。我是 GNU Core Utility 的一部分。其源代码可供下载。查看其主页,此处。
如果您想通过 C 代码实现相同的功能,请参阅以下代码。希望这对您有帮助。 :)
If you want a simple app then I suggest you can take a look at "dd" utility. I comes as part of GNU Core Utility. Its source is available for download. Take a look at its home page, here.
If you want to achieve same from a C code, then please refer to following code. Hope this helps you. :)
是的,请参阅 e2fsprogs。它提供了可用于对 ext2、ext3 和 ext4 文件系统执行任何操作(!)的工具。它还包含一个库接口,因此您可以执行其他操作。
请参阅包含的 debugfs,这可能足以让您开始。否则,检查标题并编写一些代码。
Yes, see e2fsprogs. This provides tools you can use to do anything(!) with ext2, ext3, and ext4 filesystems. It also contains a library interface so you can do anything else.
See the included debugfs, it might be enough for you to start. Otherwise, check out the headers and write some code.
磁盘设备及其中的分区的行为就像您可以读取(和写入)的常规文件一样,例如:
当然,您需要成为 root 用户。
Disk devices, and partitions within them, behave just like regular files that you can read from (and write to), e.g.:
You'll need to be root of course.