关于多分区镜像如何mount

多分区U盘/磁盘 插入电脑后 有不同的设备节点 如 /dev/sdc1, /dev/sdc2等。

可通过mount命令分开挂载。

 

多分区的镜像文件该如何挂载, 如以下sdimage.img

river@river-VirtualBox:~/image$ fdisk sdimage.img

Welcome to fdisk (util-linux 2.31.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 sdimage.img: 576 MiB, 603979776 bytes, 1179648 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: 0x09dcfcef

Device       Boot  Start     End Sectors  Size Id Type
sdimage.img1        2048  133120  131073   64M  b W95 FAT32
sdimage.img2      133121 1179647 1046527  511M 83 Linux

Command (m for help): 

该镜像文件有两个分区, 类型分别为b: W95 FAT32,   83: Linux (这里是ext4)

1. 利用mount -o offset选项进行挂载。即偏移地址。

Units: sectors of 1 * 512 = 512 bytes

一个扇区为512bytes。

故第一个分区偏移地址: 512 * 2048 = 1048576

第二个分区偏移地址: 512 * 133121 = 68157952

命令如下:

river@river-VirtualBox:~/image$ sudo mount -v -o offset=1048576 -t vfat sdimage.img ~/mount/boot/
mount: enabling autoclear loopdev flag
mount: going to use the loop device /dev/loop0
/home/river/image/sdimage.img on /home/river/mount/boot type vfat (rw,offset=1048576)
river@river-VirtualBox:~/image$ 




river@river-VirtualBox:~/image$ sudo mount -v -o offset=68157952 -t ext4 sdimage.img ~/mount/rootfs
mount: enabling autoclear loopdev flag
mount: going to use the loop device /dev/loop1
/home/river/image/sdimage.img on /home/river/mount/rootfs type ext4 (rw,offset=68157952)

 

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值