zoukankan      html  css  js  c++  java
  • mount一个整个硬盘镜像

    最近一直在搞xen,现在要给xen安装一个centOS的硬盘镜像(其中包括了引导之类的东西),然后先mount到/mnt,更改一点配置的东西。

    直接mount -o loop centOS.img /mnt 一直会出mount: you must specify the filesystem type。这个错误

    于是在这个论坛找到了答案。

    http://forum.ubuntu.org.cn/viewtopic.php?f=50&t=145930&start=0

    mount -o loop,offset=32256 centOS.img /mnt

    搞定。

    至于为什么要跳过32256,才能到分区,这个也不太清楚。论坛上说,磁盘镜像文件的前多少个字节,是给MBR,master boot record用的,但是这个玩意在磁盘的第一个扇区,也就512b。所以,这个数字的得来,等以后知道了再来补。

    32256=512*63.其中一个扇区的大小是512,第一个扇区用来存放MBR,其后的62个扇区作为保留扇区


    不同系统的开始扇区可能不一样,如何查找呢。输入如下指令:
    # fdisk -ul centorg.img

    You must set cylinders.
    You can do this from the extra functions menu.

    Disk centorg.img: 0 MB, 0 bytes
    255 heads, 63 sectors/track, 0 cylinders, total 0 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: 0x000db6d8

          Device Boot      Start         End      Blocks   Id  System
    centorg.img1   *          63    15358139     7679038+  83  Linux
    centorg.img2        15358140    16771859      706860   82  Linux swap / Solaris
    Partition 2 has different physical/logical endings:
         phys=(1023, 254, 63) logical=(1043, 254, 63)

    第一个的开始扇区为63。所以要跳过的字节数为  63*512

  • 相关阅读:
    SnagIt 9-12 注册码
    【工具推荐】LICEcap –GIF 屏幕录制工具
    linux笔记一(基础命令)
    C#性能优化:延迟初始化Lazy<T>
    CSS3实现漂亮ToolTips
    mysql数据库sql优化
    精简代码,为网站减负的十大建议
    10个简单步骤,完全理解SQL
    13个mysql数据库的实用SQL小技巧
    MyBatis源码解读(二)
  • 原文地址:https://www.cnblogs.com/cyttina/p/2845134.html
Copyright © 2011-2022 走看看