linux - golang直接从 block 读取

标签 linux file go operating-system filesystems

我有一个大约 300MB 的文件。我在 Linux 上运行以下命令:

sudo debugfs -R“stat/home/user1/Documents/test.csv”/dev/sda2

我得到以下输出:

Inode: 16913580   Type: regular    Mode:  0644   Flags: 0x80000
Generation: 3920968942    Version: 0x00000000:00000001
User:  1000   Group:  1000   Project:     0   Size: 301526706
File ACL: 0
Links: 1   Blockcount: 588928
Fragment:  Address: 0    Number: 0    Size: 0
 ctime: 0x5df9e6c2:7636fdcc -- Wed Dec 18 14:13:46 2019
 atime: 0x5e67b696:d6bfb018 -- Tue Mar 10 21:17:34 2020
 mtime: 0x5df11990:00000000 -- Wed Dec 11 22:00:08 2019
crtime: 0x5df9e6c0:63257940 -- Wed Dec 18 14:13:44 2019
Size of extra inode fields: 32
Inode checksum: 0x35f4d147
EXTENTS:
(ETB0):67695655, (0-8191):162652160-162660351, (8192-40959):165953536-165986303, (40960-57343):165986304-166002687, (57344-61439):166129664-166133759, (61440-65535):166135808-166139903, (65536-67583):166164480-166166527, (67584-71679):166168576-166172671, (71680-73614):166207623-166209557

我认为EXTENTS:显示了文件的物理 block 。

我的问题是,是否可以直接从golang中的这些 block 号中读取字节数组?

最佳答案

My question is, is it possible to directly read from these block numbers in golang as byte array?

没有。

关于linux - golang直接从 block 读取,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60624037/

相关文章:

linux - 内核自旋锁在释放锁之前启用抢占

iphone - 文件属性 NSFileModificationDate 返回 iPad 应用程序中预期时间后 5 小时的时间

visual-studio - Visual Studio 2008 自动恢复目录位置更改

戈朗 : for loop with range condition to restart

Linux perf 工具 - 如何同时分析多个进程?如何提取 CPU 周期百分比?

linux - 使用变量(这是一个 IP 地址)作为关联数组的键会产生错误

java - 获取 ArrayList 中文件的 lastModifiedDate() 和 fileSize()

sql - Golang时间比较无法正常工作

go - Golang 中的 GRPC 连接管理

linux - GTK 库如何连接到 Gnome Windows 管理器