V
V
vlarkanov2018-04-23 16:22:49
Debian
vlarkanov, 2018-04-23 16:22:49

How to mount a .raw disk from a virtual machine?

Hello! There is a disk image from the virtual machine in raw format (the virtual machine lived in Proxmox 3.x)
The minimum task is to read the files contained in the image.
The maximum task: to read the files and put the virtual machine into Proxmox, which uses LVM on CephFS as storage.
How to properly mount raw? The file structure is like this:


# fdisk -l vm-173-disk-1.raw
Drive /home/pdv/pve/vm-173-disk-1.raw: 4 GiB, 4294967296 bytes, 8388608 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
Disk label type: dos
Disk ID: 0xb72d6534 Device
Boot Start End Sectors Size Id Type
/home/ pdv/pve/vm-173-disk-1.raw1 * 2048 3905535 3903488 1.9G 83 Linux
/home/pdv/pve/vm-173-disk-1.raw2 3907582 4904959 997378 487M 5 extended
/home/pdv/pve /vm-173-disk-1.raw3 4904960 8386559 3481600 1.7G 83 Linux
/home/pdv/pve/vm-173-disk-1.raw5 3907584 4904959 997376 487M 82 Linux swap / Solaris
Partition table entries do not match partition order on disk.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Melkij, 2018-04-23
@vlarkanov

The minimum task is to read the files contained in the image.

mount -o loop,offset=$((512*start_sector_of_desired_partition)) file mountpoint
or losetup with kernel module parameter loop.max_part to some adequate value - then loop devices will be partitioned like a normal block device.
Make LV at least the same size, copy whole file block by block via dd

P
Puma Thailand, 2018-04-24
@opium

The easiest thing is to put it back in proxmox and not worry

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question