Mounting Individual Parititons in RAW Disk Images

From: http://blog.lifebloodnetworks.com/?p=934

Let us say, for the sake of simplicity, that you backup whole disks by using dd in Linux. Now let us assume that you need just a single file out of a backup and do not want to (or can not realistically) restore the whole backup to disk for the single file. You can not mount -o loop because the backup does not contain a single partition. “What to do” you ask? Well I will tell you, wary traveler.

  1. Mount your raw disk image as a loopback device: losetup /dev/loop0 [path to image]
  2. Run kpartx and: kpartx -va /dev/loop0
    This will add your partitions to /dev/mapper/loop0pX where each X is a different partition
  3. You can now mount each partition: mount /dev/mapper/loop0pX /media/partition
    If you want to make sure you do not write anything to your backup simply mount it as read-only: mount -o ro /dev/mapper/loop0pX /media/partition

Once you are finished you will need to do your clean up.

  1. Unmount: umount /media/partition
  2. Remove the mapper devices: kpartx -d /dev/loop0
  3. Remove the loopback device: losetup -d /dev/loop0

These commands may all need to be run as root. If loop0 reports that it is busy just pick another loop device (/dev/loop1, ect).


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值