Mounting

    Raw File

    VM with partitions

    Useful when you're not able to access the VM through ssh or login.

    mkdir /mnt/168
    mount -o ro,loop,offset=1048576 -t auto /var/lib/vz/images/168/vm-168-disk-1.raw /mnt/168
    

    Notes:

    • offset is computed from start sector * size of a sector in bytes. You can retrieve these informations through fdisk -u sectors -l /var/lib/vz/images/168/vm-168-disk-1.raw
    • remove ro, if you need to write

    Source

    LXC

    Mounting

    losetup /dev/loop0 /var/lib/vz/images/100/vm-100-disk-1.raw
    mount /dev/loop0p1 /mnt/tmpdiskrescue
    

    Note: I think it's possible to avoid losetup ... by using mount -o loop which will automatically find an available loopX

    Umounting

    umount /mnt/tmpdiskrescue
    losetup -d /dev/loop0