您尚未登录。

楼主 #1 2020-05-11 10:14:10

物联小白
会员
注册时间: 2018-05-17
已发帖子: 19
积分: 19

请问如何在Ubuntu下面挂载有三个分区的TF卡镜像文件, 我需要修改里面的文件内容。

请问如何在Ubuntu下面挂载有三个分区的TF卡镜像文件, 我需要修改里面的文件内容。

离线

#2 2020-05-11 11:20:06

哇酷小二
wechat微信:whycan_cn
所在地: 你猜
注册时间: 2020-04-22
已发帖子: 3,378
积分: 1902
个人网站

Re: 请问如何在Ubuntu下面挂载有三个分区的TF卡镜像文件, 我需要修改里面的文件内容。

https://raspberrypi.stackexchange.com/questions/13137/how-can-i-mount-a-raspberry-pi-linux-distro-image

按这个帖子的高票答案做就可以了:

fdisk -l whatever.img

Device         Boot     Start       End  Blocks  Id System
whatever.img1            8192    122879   57344   c W95 FAT32 (LBA)
whatever.img2          122880   5785599 2831360  83 Linux

计算偏移:
1st partition 512 * 8192 = 4194304
2nd partition 512 * 122880 = 62914560

挂载:

mount -v -o offset=4194304 -t vfat whatever.img /mnt/img/one
mount -v -o offset=62914560 -t ext4 whatever.img /mnt/img/two




离线

楼主 #3 2020-05-11 11:30:49

物联小白
会员
注册时间: 2018-05-17
已发帖子: 19
积分: 19

Re: 请问如何在Ubuntu下面挂载有三个分区的TF卡镜像文件, 我需要修改里面的文件内容。

谢谢大佬, 这招不错, 已经学到了

$ fdisk -l /mnt/hgfs/E/v3s_wifi_ap6212_debug.img 

Disk /mnt/hgfs/E/v3s_wifi_ap6212_debug.img: 1996 MB, 1996488704 bytes
255 heads, 63 sectors/track, 242 cylinders, total 3899392 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
Disk identifier: 0x00034daf

                                    Device Boot      Start         End      Blocks   Id  System
/mnt/hgfs/E/v3s_wifi_ap6212_debug.img1            2048      526335      262144    6  FAT16
/mnt/hgfs/E/v3s_wifi_ap6212_debug.img2          526336     3598335     1536000   83  Linux


$mount -v -o offset=$((2048*512)) -t vfat /mnt/hgfs/E/v3s_wifi_ap6212_debug.img /tmp/one
$mount -v -o offset=$((526336*512)) -t vfat /mnt/hgfs/E/v3s_wifi_ap6212_debug.img /tmp/two

挂载成功了。

离线

#4 2020-06-09 15:51:42

流氓兔
会员
注册时间: 2020-02-01
已发帖子: 121
积分: 109.5

Re: 请问如何在Ubuntu下面挂载有三个分区的TF卡镜像文件, 我需要修改里面的文件内容。

还有这种骚操作?!get it!

离线

#5 2020-07-04 21:26:25

smartcar
会员
注册时间: 2018-02-19
已发帖子: 735
积分: 735

Re: 请问如何在Ubuntu下面挂载有三个分区的TF卡镜像文件, 我需要修改里面的文件内容。

优秀,刚刚试了一把,可以直接挂载并且修改img分区里面任意文件。

离线

#6 2020-07-23 09:50:11

shaoxi2010
会员
注册时间: 2019-06-13
已发帖子: 364
积分: 313

Re: 请问如何在Ubuntu下面挂载有三个分区的TF卡镜像文件, 我需要修改里面的文件内容。

没那么麻烦拉,再给大家推荐一个傻瓜方法kpartx,一句命令搞定。
https://blog.csdn.net/qq_28693567/article/details/80324846

离线

#7 2020-07-23 10:08:43

smartcar
会员
注册时间: 2018-02-19
已发帖子: 735
积分: 735

Re: 请问如何在Ubuntu下面挂载有三个分区的TF卡镜像文件, 我需要修改里面的文件内容。

shaoxi2010 说:

没那么麻烦拉,再给大家推荐一个傻瓜方法kpartx,一句命令搞定。
https://blog.csdn.net/qq_28693567/article/details/80324846

这个好,学到一招。

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn