Openvz "Failed to mount image" - Fix it Now ?








Sometimes while trying to start an Openvz Container we may end up with a "Failed to mount image" error.

Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to perform related Openvz queries.


What triggers Openvz "Failed to mount image" error ?

This error may look like the one given below:

vzctl start 153
Dump file /vz/dump/Dump.192 exists, trying to restore from it
Restoring container ...
Opening delta /vz/private/192/root.hdd/root.hdd
Data cluster 1112 beyond EOF, vsec=47137...
FATAL
Error in ploop_check (check.c:547): Fatal errors were found, image /vz/private/192/root.hdd/root.hdd is not repaired
Error in check_deltas (check.c:631): /vz/private/192/root.hdd/root.hdd : irrecoverable errors
Failed to mount image: Error in check_deltas (check.c:631): /vz/private/192/root.hdd/root.hdd : irrecoverable errors [11]
Starting container...

The main cause of this error is that the container's mount fails due to file system errors inside the ploop virtual disk.


How to fix Openvz "Failed to mount image" error ? 

To begin, we must run the check disk.

To do this, run fsck in the following the steps;


1. Ensure that the container is stopped by using the following commands:

~# vzctl stop 101
~# vzlist 101
CTID NPROC STATUS IP_ADDR HOSTNAME
101 - stopped 10.10.10.11 fsck.test

Note: Do not perform fsck when the container is running or mounted.


2. Mount the container's ploop image. This allocates a ploop device on the host:

~# ploop mount /vz/private/101/root.hdd/DiskDescriptor.xml

add delta dev=/dev/ploop12345 img=/vz/private/101/root.hdd/root.hds (rw)


3. Run fdisk -l for the /dev/ploopX device reported by the previous command.

We will need to let the system fetch a list of partitions on /dev/ploopX:

~# fdisk -l /dev/ploop12345
WARNING: GPT (GUID Partition Table) detected on '/dev/ploop12345'! The util fdisk doesn't support GPT. Use GNU Parted.
Disk /dev/ploop12345: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Device Boot      Start         End      Blocks   Id  System
/dev/ploop12345p1               1        1306    10485759+  ee  GPT

4. After that we will perform a file system check for the partition reported in the previous command’s output (note p1 at the end):

~# e2fsck /dev/ploop12345p1
e2fsck 1.41.12 (17-May-2010)
/dev/ploop12345p1: clean, 22404/655360 files, 238012/2620923 blocks

Note: We can add more options to e2fsck, check the manual pages if needed.


5. Now we can unmount the ploop image with the following commands:

~# ploop umount -d /dev/ploop12345
Unmounting device /dev/ploop12345

6. Finally, we can start the container using the following:

~# vzctl start 101


[Need assistance in fixing Linux System errors? We can help you. ]



Conclusion

This article covers methods to tackle Openvz "Failed to mount image" error for our customers. 

To fix this error after the hardware reboot,

# ploop check -F /vz/private/139/root.hdd/root.hdd
# ploop mount /vz/private/139/root.hdd/DiskDescriptor.xml
# fdisk -l /dev/ploop56824
# e2fsck /dev/ploop56824p1
# vzctl start 139

For Linux Tutorials

We create Linux HowTos and Tutorials for Sys Admins. Visit us on LinuxAPT.com

Also for Tech related tips, Visit forum.outsourcepath.com or General Technical tips on www.outsourcepath.com