How to fix corrupted ploop

From vpsget wiki
Jump to: navigation, search

Stop the container/ check container status where ploop problem exists

[if you are working in your own environment with "backup files" that looking like like "root.hdd" - ploop file and "DiskDescriptor.xml" you should not stop any containers]

NOTE: your kernel may not support ploop - in this case you may refer to the man pages: is it possible to add or compile kernel module for your *nix build //or google it /whatever.

FIRST make a copy of ploop and work with a copy keeping original as it. so you will be always to get back to orig ploop and start other methodologies to recover.

Refer to the link provided at the end of this article for alternate method of adding kernel support into your Linux build.

Mount the container’s ploop image. Check fdisk:

cd  /vz/private/CTID
fdisk -l root.hdd/root.hdd 

Mount:

ploop mount root.hdd/DiskDescriptor.xml       
Opening delta /vz/private/16311/root.hdd/root.hdd
Adding delta dev=/dev/ploop28980 img=/vz/private/16311/root.hdd/root.hdd (rw)
#note the dev=/dev/ploop2890

Most likely you 'll get error:

 Error in ploop_check (check.c:549): Fatal errors were found, image /vz/private/111/root.hdd/root.hdd is not repaired
 Error in check_deltas (check.c:638): /vz/private/1111/root.hdd/root.hdd : irrecoverable errors (rw)

Then try to use ploop check:

ploop check -dFc root.hdd/root.hdd 
#
Reopen rw root.hdd/root.hdd
Data cluster 20063 beyond EOF, vsec=980... 
Fixed
Error in ploop_check (check.c:574): Dirty flag is set

You may see more options just type ploop check --help.

Now try fdisk -l and see if you can see partitions:

ploop mount root.hdd/DiskDescriptor.xml  
fdisk -l /dev/ploop28980 

WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.

Disk /dev/ploop17795: 42.9 GB, 42949672960 bytes, 83886080 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
Disk label type: gpt
Disk identifier: FB****43-98F2-424B-BA78-9********91

#         Start          End    Size  Type            Name
 1         2048     83884031     40G  Microsoft basic primary

Gr8 if you able to see partition! You may also able to view the exact partition names but not see the disk identifier. Anyway the both cases are good:

  fdisk -l /dev/ploop40539 
  WARNING: GPT (GUID Partition Table) detected on '/dev/ploop40539'! The util fdisk doesn't support GPT. Use GNU Parted. 
  Disk /dev/ploop40539: 64.4 GB, 64424509440 bytes
  255 heads, 63 sectors/track, 7832 cylinders
  Units = cylinders of 16065 * 512 = 8225280 bytes
  Sector size (logical/physical): 512 bytes / 512 bytes
  I/O size (minimum/optimal): 1048576 bytes / 4194304 bytes
  Disk identifier: 0x00000000
  #
             Device Boot      Start         End      Blocks   Id  System
  /dev/ploop40539p1               1        7833    62914559+  ee  GPT
  #

now just try to mount it with usual mount and add p1 to the ploop dev name

 mkdir /mnt/ploop-restore1
 mount -r -o noload /dev/ploop28980p1  /mnt/ploop-restore1/

Go to the mounted dir and copy your data!


ALTERNATE WAY if you got more trouble :

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

As from previous mount ploop output we can see how it's mounted: "dev=/dev/ploop2890"

Try e2fsck [if you can see partitions with fdisk -l try with adding p1]

e2fsck -y  /dev/ploop28980p1

You may try without p1 if you can't see the partitions but most likely with no luck.


If fail try with another superblock:

mke2fs /dev/ploop28980p1    # note the block here and use one of them
e2fsck -b 32768  /dev/ploop28980

Maybe mount/remount and give a check w/o specifying superblock

e2fsck  /dev/ploop28980p1


___________________ if still issues you may try to mount ploop into folder and copy data


Optional. Better remount ploop for any case.

ploop umount -d /dev/ploop1234
ploop mount root.hdd/DiskDescriptor.xml   


Now use "mount" to Mount into some dir

mkdir /mnt/ploop-restore1
mount -r -o noload /dev/ploop30196p1 /mnt/ploop-restore1


In case of errors try to repeat e2fsck with additional optons like check for bad blocks:

 e2fsck -c -f /dev/ploop33512p1


  • Tool for mounting OpenVZ ploop images without support from kernel side:*

This link may be helpfull if you do not have ploop kernel support (we did not tested it!):

https://github.com/FastVPSEestiOu/ploop_userspace/

""