Mounting VPS image offline

first use fdisk to see partitions' offsets

# fdisk -l /dev/xvda
 
Disk /dev/sda: 149.1 GiB, 160041885696 bytes, 312581808 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
Disklabel type: dos
Disk identifier: 0x000c25fa
 
Device     Boot    Start       End   Sectors   Size Id Type
/dev/sda1  *        2048  19531775  19529728   9.3G 83 Linux
/dev/sda2       19531776  58593279  39061504  18.6G 83 Linux
/dev/sda3       58595326 312580095 253984770 121.1G  5 Extended
/dev/sda5       58595328 312580095 253984768 121.1G 83 Linux

or you can use it for an image, here is another example with usb flash.iso file

# fdisk -l vps01.iso
 
Disk finexo-flash.iso: 7.2 GiB, 7747397632 bytes, 15131636 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
Disklabel type: gpt
Disk identifier: EEADAEAD-CA33-4934-81D5-06161B87C41C
 
Device               Start      End  Sectors  Size Type
vps01.iso1     2048 12994559 12992512  6.2G Linux filesystem
vps01.iso2 12998656 15131602  2132947    1G EFI System

The offset of the first partition is in both cases 2048 *sectors* not bytes. One sector is 512 Bytes so the real offset in bytes is 2048*512 (2^11*2^9 = 2^20 = 1048576)

mount -o loop,offset=$[2048*512]  vps01.iso /mnt

…well done :-)