2009-11-29

磁盘完整映像的mount

磁盘完整映像的mount


在linux下我们常常用dd来对硬盘进行完整备份.本文告诉你如何把这个完整备份文件,mount到系统中加以利用.
dd做出来的备份,虽然没有压缩,体积巨大, 但是,我们可以把它的分区mount到系统中处理它的数据.

要mount磁盘映像,就要用到mount的-o office参数来指定分区的开始位置. offset的参数的单位是字节.
我们只要找到分区的开始位置字节数, 就能顺利的mount这个磁盘映像的分区.

可以使用fdisk来看每个分区的起始逻辑扇区号,扇区号乘以512就是我们所要的偏移值,
由下面的例子,我们可以看出有2个主分区,第2个是有效的,偏移分别是
hda1=2048*512=1048576,hda2=13672448*512=7000293376
因此mount命令分别是:
mount -o loop,offset=1048576 hda.img /mnt/hda1
mount -o loop,offset=7000293376 hda.img /mnt/hda2 

#fdisk -l -u -C 1  hda.img

Disk hda: 0 MB, 0 bytes
255 heads, 63 sectors/track, 1 cylinders, total 0 sectors
Units = sectors of 1 * 512 = 512 bytes

Device Boot      Start         End      Blocks   Id  System
  hda1            2048    13672447     6835200   27  Unknown
Partition 1 does not end on cylinder boundary.
  hda2   *    13672448   117208191    51767872    7  HPFS/NTFS
Partition 2 has different physical/logical endings:
     phys=(1023, 254, 63) logical=(7295, 222, 31)


原文:http://www.anheng.com/news/29/1137.html



Read More...