allomov
5/23/2015 - 10:27 AM

problem-with-mounting-loopback-device.md

The problem

A mount command fails On this line of image_install_grub stage. Here is the error message:

mount: wrong fs type, bad option, bad superblock on /dev/mapper/loop0p2,
       missing codepage or helper program, or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so

dmesg | tail shows following output:

[313627.114216] loop: Write error at byte offset 2189422592, length 4096.
[313627.114314] loop: Write error at byte offset 2516066304, length 4096.
[313627.114432] loop: Write error at byte offset 2516168704, length 4096.
[313628.825294] JBD2: recovery failed
[313628.825304] EXT4-fs (dm-1): error loading journal

Still I can mount /dev/mapper/loop0p2, but in read-only mode: sudo mount -ro,noload /dev/mapper/loop0p2 /mnt/stemcells/openstack/kvm/ubuntu/work/work/mnt. And it does has files for root system.

At this moment I consider that problem is in how loopback devise is set up in this code of image_create stage.

Background

image_create and image_install_grub are the last stages for building stemcell before its packaging. This stage go sequently.

image_create should create loopback device and rsync files from chroot directory (link to sources).

image_install_grub installs grub to an existing loopback device (link to sources).