I've recently created a backup file for my Ubuntu 16.04.4 server using dd in order to prepare for migrating to a larger SSD. I want to mount the backup image through a separate Ubuntu VM running on my local machine to check that the backup worked as expected.

Attempting to loop mount as follows:

mount -o loop image ~/mnt/serverTest

Returns the following error:

mount: /root/mnt/serverTest: can't read superblock on /dev/loop6

Examining the image using fdisk as follows:

fdisk -l image

Gives the following output:

Disk image: 30 GiB, 32212254720 bytes, 62914560 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: 0xc3ed8245

Device     Boot Start      End  Sectors Size Id Type
image1     *     2048 62914526 62912479  30G 83 Linux

This looks pretty promising to me - it seems as though the backup image has been generated correctly - and I even attempted the loop mount with an offset (512*2048=1048576) as follows:

mount -o loop,offset=1048576 image ~/mnt/serverTest

But the exact same error stating that the superblock can't be read comes back.

Finally, examining the image file with badblocks reports no corrupted blocks, however executing fsck.ext4 image reports a bad magic number in super-block and states that a dos partition table has been found.

TL;DR - Mount errors and fsck.ext4 output seem to suggest something wrong with the backup image, but fdisk output looks alright. What am I missing?

  • Just to confirm part of what you seem to have already figured out, and maybe clarify some that you haven’t: Commands like mount and fsck operate on a filesystem, which typically resides in a partition.  Your backup is a disk image that contains a partition table and one partition.  So fsck.ext4 image shouldn’t work.  AFAIK, the mount command should have worked with offset=; I don’t know why it didn’t.  What happens if you say offset=1024KiB or 1MiB?  Also, try 2048KiB and 2MiB (just in case fdisk is reporting the partition start and end points in 1K blocks). – G-Man Jun 20 '18 at 3:23
  • 1
    Cheers for the response G-Man. Your clarification on fsck makes sense. Passing in a disk image when fsck is expecting a file system shouldn't work. I tried all your suggested modifications to the offset parameter but unfortunately none of them made any difference - still the same superblock error. – rustyDog Jun 20 '18 at 3:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.