How to perform fsck on a ploop container?

StockSnap_TIV258VG3N-1170x400

Due to various reasons like system crash, incorrect replication level etc, the file system in a ploop container will get corrupted that can result in data loss. So it is necessary to check the filesystem in a ploop container for consistency to avoid this loss of data.

Error

~# vzctl start 123

Starting container…

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

Adding delta dev=/dev/ploopxxxxx img=/vz/private/123/root.hdd/root.hdd (rw)

/dev/ploopxxxxxp1: 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)

Resolution

1. Stop the container

2. Mount the container’s ploop image.

3. Run fdisk -l for the ploop device reported by the previous command.

4. Perform a file system check for the partition reported in the previous command’s output.

5. Unmount the ploop image

6. Start the container.

 

Done! You should be good to go now!

Leave a Reply