方法1
losetup /dev/loop0 test.img
fdisk -l -u /dev/loop0
/dev/sda2 53 12748 61440592+ 83 Linux
mount -t ntfs -o loop,offset=32256 /var/test.img /mnt #offset是分区起始*512 (53*512)
方法2:
losetup /dev/loop0 test.img
kpartx -a /dev/loop0
mount -t ntfs /dev/mapper/loop0p1 /mnt
方法3:
lomount -t ntfs -diskimage test.img -partition 1 /mnt
如果分区里有LVM,则稍微麻烦一些
losetup /dev/loop0 test.img
kpartx -a /dev/loop0
vgscan 找到VolGroup00
vgchange -a y VolGroup00 激活
mount /dev/VolGroup00/xxx /tmp/xxx
如果lvm两个卷同名,则需要对另一个进行重命名
[root@localhost ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/hda2 VolGroup00 lvm2 a- 76.22G 32.00M
/dev/hdc2 VolGroup00 lvm2 a- 74.38G 32.00M
两个VG名称居然一样,
[root@localhost ~]# vgrename VolGroup00 VolGroup88
Found more than one VG called VolGroup00. Please supply VG uuid.
[root@localhost ~]# vgrename TPPyoP-THgg-zvnG-r07O-ZSx4-hKqR-8eXK92 VolGroup88
Volume group “VolGroup00″ still has active LVs
卸载
vgchange -a n /dev/Volxxx
kpartx -d /dev/loopx
losetup -d /dev/loopx
阅读(960) | 评论(0) | 转发(0) |