Perform fsck on a ploop container

Due to the system crash the file system in a ploop container will get corrupted . Due to corruption of file system there is a chance of causing data loss. To avoid data loss it is necessary to check the filesystem in a ploop image for consistency to avoid data loss. Please follow the below steps to do the fsck in ploop container.

ERROR:

~# vzctl start 132

Starting container…

Opening delta /vz/private/132/root.hdd/root.hdd

Adding delta dev=/dev/ploop64734 img=/vz/private/132/root.hdd/root.hdd (rw)

/dev/ploop64734p1: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.

(i.e., without -a or -p options)

Error in e2fsck (fsutils.c:315): e2fsck failed (exit code 4)

Failed to mount image: Error in e2fsck (fsutils.c:315): e2fsck failed (exit

code 4)

==============================================================================

Solution:

1)Stop the container.

~# vzctl stop 132

~# vzlist 132

CTID NPROC STATUS IP_ADDR HOSTNAME

132 – stopped 192.168.0.10 server.adminz

2)Mount the ploop image.

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

add delta dev=/dev/ploop64734 img=/vz/private/132/root.hdd/root.hdd (rw)

3)Perform fdisk -l

~# fdisk -l /dev/ploop64734

WARNING: GPT (GUID Partition Table) detected on ‘/dev/ploop64734’! The util fdisk doesn’t support GPT. Use GNU Parted.

Disk /dev/ploop64734: 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/ploop64734p1 1 1306 10485759+ ee GPT

4)Perform a file system check for the partition(note p1 at the end):

~# e2fsck /dev/ploop64734p1

e2fsck 1.41.12 (17-May-2010)

/dev/ploop64734p1: clean, 22404/655360 files, 238012/2620923 blocks

5)Unmount the ploop image

~# ploop umount -d /dev/ploop64734

Unmounting device /dev/ploop64734

6)Start the container

~# vzctl start 132