How to mount dd image of digital ocean

ddimage

I have created a dd image of /dev/vda using the following command:

ssh root@1.2.3.4 "dd if=/dev/vda" | dd of=/home/backup/vda.img

and I can't mount it on my local Ubuntu server where I transferred it.

I get this in dmesg | tail :

[763158.222159] EXT4-fs error (device loop0): ext4_map_blocks:504: inode #8:block 10541546: comm mount: lblock 23018 mapped to illegal pblock (length 1)
[763158.222299] jbd2_journal_bmap: journal block not found at offset 23018 on loop0-8
[763158.222367] JBD2: bad block at offset 23018
[763158.222581] JBD2: recovery failed
[763158.222588] EXT4-fs (loop0): error loading journal

If I try to check it out with file I get:

vda.img: data

Any idea what it could be?

Using kpartx as Sven suggested I get:

kpartx -l /home/backup/vda.img
loop deleted : /dev/loop0

I have rebooted the system and tried the command again:

kpartx -lv /home/backup/vda.img
ioctl: LOOP_CLR_FD: Device or resource busy
can't del loop : /dev/loop0

And in dmesg | tail i get

[ 73.445903] device-mapper: uevent: version 1.0.3
[ 73.446574] device-mapper: ioctl: 4.22.0-ioctl (2011-10-19) initialised: dm-devel@redhat.com

Best Answer

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.

Related Topic