How to mount dd image of digital ocean?

Solution 1:

You likely need to mount partitions inside the image file. This can be done with kpartx.

kpartx -l /path/to/image

will list partitions inside the file and

kpartx -a /path/to/image

will add them to /dev/mapper/loopXpY (where X and Y varies), from where you can mount them with mount.

See man kpartx for more info.

Solution 2:

I have managed to fix the issue in the following way:

I checked the size of the partition that i wished to copy and then i created a local file with that size on the backup server and created the partition inside it using the following commands:

fallocate -l 85899345920 vda.img
fdisk -H 16 vda.img
kpartx -a vda.img
mount /dev/mapper/loop1p1 /mnt/test/ -t ext4

Then i used dd to copy the data from the server to the backup partition.

Checked everything around and all seems fine.