fdisk /var/lib/vz/template/iso/DS918__7.1.0-42661-yindao.img

输出

Welcome to fdisk (util-linux 2.36.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): 

输入 p 后,输出

Disk /var/lib/vz/template/iso/DS918__7.1.0-42661-yindao.img: 160 MiB, 167772160 bytes, 327680 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x1ef471e9

Device                                                  Boot  Start    End Sectors Size Id Type
/var/lib/vz/template/iso/DS918__7.1.0-42661-yindao.img1        2048 133119  131072  64M 83 Linux
/var/lib/vz/template/iso/DS918__7.1.0-42661-yindao.img2      133120 319487  186368  91M 83 Linux
/var/lib/vz/template/iso/DS918__7.1.0-42661-yindao.img3      319488 327679    8192   4M 83 Linux

退出,输入 q
从上面我们可以得出 start .img1 开始扇区是 2048那么分区是

2048*512=1048576

512 来自 上面返回信息中的 Units: sectors of 1 * 512 = 512 bytes
最后挂载img镜像

# 创建临时目录
mkdir -p /mnt/tmpqh12
# 挂载
mount -o loop,offset=1048576 /var/lib/vz/template/iso/DS918__7.1.0-42661-yindao.img /mnt/tmpqh12

#最后 进入目录,可以看到文件了
cd /mnt/tmpqh12

关闭挂载

umount /mnt/tmpqh12
Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐