找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 3028|回复: 1

[其它] Linux 下ros img镜像挂载

[复制链接]
发表于 2011-10-30 00:02:33 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册

×
本帖最后由 jifei 于 2011-10-30 00:20 编辑

[root@linux ros2.927]# ls
PHYSDISKWRITE.EXE  ROS2.927.img  安装.BAT
[root@linux ROS2.927]# file ros2.927.img
ros2.927.img: x86 boot sector; partition 1: ID=0x83, active, starthead 0, startsector 1, 209663 sectors, code offset 0x31
[root@linux ROS2.927]# fdisk -lu ros2.927.img

Disk ros2.927.img: 107 MB, 107348480 bytes
4 heads, 63 sectors/track, 832 cylinders, total 209665 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: 0xcf28cf28

       Device Boot      Start         End      Blocks   Id  System
ros2.927.img1   *           1      209663      104831+  83  Linux
[root@linux ROS2.927]# mkdir /mnt/ros2.927
[root@linux ROS2.927]# losetup -a
/dev/loop2: [0012]:15 (/root/.gvfs/192.168.11.4 上的 wm2/外置程序/ros安装/ROS*), offset 512
/dev/loop3: [0012]:15 (/root/.gvfs/192.168.11.4 上的 wm2/外置程序/ros安装/ROS*), offset 512
/dev/loop4: [0012]:24 (/root/.gvfs/192.168.11.4 上的 wm2/外置程序/ros安装/ROS*), offset 512
[root@linux ROS2.927]# mount -o loop,offset=512 ros2.927.img /mnt/ros2.927
[root@linux ROS2.927]# ls /mnt/ros2.927
bin   CDINSTALL  etc   initrd  lost+found  old      proc    root  tmp  var
boot  dev        home  lib     nova        postlog  REBOOT  sbin  usr  x
第二种方法:

[root@linux ROS2.927]#fdisk ros2.927.img

计算出偏移offset=start_sector(Start) x sector_byte_size

[root@linux ROS2.927]#losetup -of 512 ros2.927.img
[root@linux ROS2.927]#losetup -a
/dev/loop0: [0012]:15 (/root/.gvfs/192.168.11.4 上的 wm2/外置程序/ros安装/ROS*), offset 512
查看默认使用那你一个loop
[root@linux ROS2.927]#mount /dev/loop0 /mnt
[root@linux ROS2.927]#ls /mnt
bin   CDINSTALL  etc   initrd  lost+found  old      proc    root  tmp  var
boot  dev        home  lib     nova        postlog  REBOOT  sbin  usr  x



备注:遇到不可挂载的ros img镜像可使用 file 查看ID=0x83 说明镜像为ext3磁盘格式

fdisk -lu xxx.img 查看镜像文件可以计算出文件的偏移offset=start_sector x sector_byte_size(即offse=1*512)

losetup -a 查看系统loop占用情况

然后就可以用mount挂载镜像了,如: mount -o loop,offset=512 ros2.927.img /mnt/ros2.927
这里系统使用的是Fedora14-live版进行测试,其他版本可自行探索

评分

参与人数 1铜板 +6 收起 理由
心想事成 + 6 赞一个!

查看全部评分

routeros
发表于 2011-11-6 20:56:59 | 显示全部楼层
有点复杂,看不懂了
routeros
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|手机版|小黑屋|软路由 ( 渝ICP备15001194号-1|渝公网安备 50011602500124号 )

GMT+8, 2024-5-5 15:41 , Processed in 0.046973 second(s), 4 queries , Gzip On, Redis On.

Powered by Discuz! X3.5 Licensed

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表