Re: RBD images -- parent snapshot missing (help!)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi!

The program is in attachment.

WARNING: USE IN AT YOUR OWN RISK, NO WARRANTIES ARE PROVIDED!!!
IT MAY CORRUPT YOUR DATA!!!

You need to install rados-dev and compile the program with:

gcc ./upd_parent.c -o upd_parent -lrados

To change ID of parent image pool you need to run it with following arguments:

 ./upd_parent <old_wrong_pool_id> <new_correct_pool_id> <image_pool_name> <image_name>

for example (lost pool was 13, new pool is 20, image pool name is "volumes"):

 ./upd_parent 13 20 volumes volume-c083800d-7688-4fb8-9230-83643cbe8927

Hope, it will helps.
I recommend you to try to mount fixed image read-only, copy all important data (if possible) and only after that try to boot it or run fsck.

Pavel.

Attachment: upd_parent.c
Description: Binary data



> 16 мая 2015 г., в 7:13, Tuomas Juntunen <tuomas.juntunen@xxxxxxxxxxxxxxx> написал(а):
> 
> Hey Pavel
> 
> Could you share your C program and the process how you were able to fix the images.
> 
> Thanks
> 
> Tuomas
> 
> -----Original Message-----
> From: ceph-users [mailto:ceph-users-bounces@xxxxxxxxxxxxxx] On Behalf Of Pavel V. Kaygorodov
> Sent: 13. toukokuuta 2015 18:24
> To: Jason Dillaman
> Cc: ceph-users
> Subject: Re:  RBD images -- parent snapshot missing (help!)
> 
> Hi!
> 
> Thank you for you effort, I think it will be very useful for many people!
> Now I have solved the problem, using C program and radios library, 2 images from 3 is completely restored, one was corrupted, but I have rescued all important data :)
> 
> Pavel.
> 
> 
> 
>> 13 мая 2015 г., в 17:20, Jason Dillaman <dillaman@xxxxxxxxxx> написал(а):
>> 
>> I just pushed an update to the rados CLI that allows the setomapval command to read the data from stdin.  In your example below, the command to use would be:
>> 
>> # cat ./rbd_header.9a3ab3d1382f3-parent | rados -p volumes setomapval 
>> rbd_header.9a3ab3d1382f3 parent
>> 
>> The change is currently under review in the wip-rados-binary-omapsetval branch.  If you wanted to test it out on a scratch machine, the packages should be available within the next hour or so from the gitbuilder.  See the Ceph website for documentation on how to install development packages [1].
>> 
>> [1] 
>> http://docs.ceph.com/docs/master/install/get-packages/#add-ceph-develo
>> pment
>> 
>> --
>> 
>> Jason Dillaman
>> Red Hat
>> dillaman@xxxxxxxxxx
>> http://www.redhat.com
>> 
>> 
>> ----- Original Message -----
>> From: "Pavel V. Kaygorodov" <pasha@xxxxxxxxx>
>> To: "Tuomas Juntunen" <tuomas.juntunen@xxxxxxxxxxxxxxx>
>> Cc: "ceph-users" <ceph-users@xxxxxxxxxxxxxx>
>> Sent: Tuesday, May 12, 2015 3:55:21 PM
>> Subject: Re:  RBD images -- parent snapshot missing 
>> (help!)
>> 
>> Hi!
>> 
>> I have found a way to change a pool ID for image parent:
>> 
>> list images:
>> 
>> # rbd ls volumes
>> 5a4b167d-2588-4c06-904c-347abf91d788_disk.swap
>> volume-0ed965a0-53a5-4054-ad9c-3a432c8455d6
>> volume-1269b41a-4af0-499b-a16c-9bb6a5b98e70
>> volume-4094fbc1-9969-47aa-a0de-7026678b8e64
>> volume-5958295e-9623-4c46-b1e6-2017c6574805
>> volume-8448a317-d802-48fa-8bc1-ffd4c524fa43
>> volume-c083800d-7688-4fb8-9230-83643cbe8927
>> 
>> I want to repair volume volume-c083800d-7688-4fb8-9230-83643cbe8927, so get its internal ID:
>> 
>> #rados -p volumes get 
>> rbd_id.volume-c083800d-7688-4fb8-9230-83643cbe8927 ./image-id #cat 
>> ./image-id
>> 
>> # hexdump -C image-id 00000000  0d 00 00 00 39 61 33 61  62 33 64 31 33 38 32 66  |....9a3ab3d1382f|
>> 00000010  33                                                |3|
>> 00000011
>> 
>> So, ID is 9a3ab3d1382f3, get omap key/value pairs:
>> 
>> # rados -p volumes listomapvals rbd_header.9a3ab3d1382f3     features
>> value: (8 bytes) :
>> 0000 : 01 00 00 00 00 00 00 00                         : ........
>> 
>> object_prefix
>> value: (26 bytes) :
>> 0000 : 16 00 00 00 72 62 64 5f 64 61 74 61 2e 39 61 33 : ....rbd_data.9a3
>> 0010 : 61 62 33 64 31 33 38 32 66 33                   : ab3d1382f3
>> 
>> order
>> value: (1 bytes) :
>> 0000 : 17                                              : .
>> 
>> parent
>> value: (46 bytes) :
>> 0000 : 01 01 28 00 00 00 0d 00 00 00 00 00 00 00 0c 00 : ..(.............
>> 0010 : 00 00 38 61 65 63 32 65 37 34 65 62 30 36 22 00 : ..8aec2e74eb06".
>> 0020 : 00 00 00 00 00 00 00 00 00 40 00 00 00 00       : .........@....
>> 
>> size
>> value: (8 bytes) :
>> 0000 : 00 00 00 80 00 00 00 00                         : ........
>> 
>> snap_seq
>> value: (8 bytes) :
>> 0000 : 00 00 00 00 00 00 00 00                         : ........
>> 
>> we see key "parent", where 0x0d might be an old pool id (13), new one is 20 (0x14), so we can dump this key into file:
>> 
>> # rados -p volumes getomapval rbd_header.9a3ab3d1382f3 parent ./rbd_header.9a3ab3d1382f3-parent    
>> (length 46) : Writing to ./rbd_header.9a3ab3d1382f3-parent
>> 
>> # hexdump -C rbd_header.9a3ab3d1382f3-parent
>> 00000000  01 01 28 00 00 00 0d 00  00 00 00 00 00 00 0c 00  
>> |..(.............|
>> 00000010  00 00 38 61 65 63 32 65  37 34 65 62 30 36 22 00  |..8aec2e74eb06".|
>> 00000020  00 00 00 00 00 00 00 00  00 40 00 00 00 00        |.........@....|
>> 0000002e
>> 
>> Here is it! Now we can edit it with hexedit, replacing 0d to 14 and put the value back:
>> 
>> # rados -p volumes setomapval rbd_header.9a3ab3d1382f3 parent ...........
>> 
>> BUT!!!!!
>> It seems to be impossible to put binary data with zeroes into bash argument, so "rados setomapval" seems to be completely useless in this case.
>> 
>> I still need help!
>> 
>> Pavel.
>> 
>> 
>> 
>>> 12 мая 2015 г., в 20:54, Tuomas Juntunen <tuomas.juntunen@xxxxxxxxxxxxxxx> написал(а):
>>> 
>>> Hi
>>> 
>>> I am having this exact same problem, for more than a week. I have not 
>>> found a way to do this either.
>>> 
>>> Any help would be appreciated. 
>>> 
>>> Basically all of our guests are now down, even though they are not in 
>>> production, we would still need to get the data out of them.
>>> 
>>> Br,
>>> Tuomas
>>> 
>>> -----Original Message-----
>>> From: ceph-users [mailto:ceph-users-bounces@xxxxxxxxxxxxxx] On Behalf 
>>> Of Pavel V. Kaygorodov
>>> Sent: 12. toukokuuta 2015 20:41
>>> To: ceph-users
>>> Subject:  RBD images -- parent snapshot missing (help!)
>>> 
>>> Hi!
>>> 
>>> I have an RBD image (in pool "volumes"), made by openstack from 
>>> parent image (in pool "images").
>>> Recently, I have tried to decrease number of PG-s, to avoid new 
>>> Hammer warning.
>>> I have copied pool "images" to another pool, deleted original pool 
>>> and renamed new pool to "images". Ceph allowed me to do this without 
>>> any warning.
>>> But, after a some time my VM-s was stopped and cannot be started 
>>> again, because they cannot open volumes, which had parent snapshots on "images"
>>> pool.
>>> I have an original image unchanged, I can made a snapshot if it was 
>>> not copied by "radios cppool", but RBD images linked to parent 
>>> snapshot on pool with old ID, now this pool has new ID.
>>> So, I need to change the link to parent snapshot for RBD images, or 
>>> change pool id of "images" to old one.
>>> How to do this?
>>> 
>>> Help, please!
>>> 
>>> Pavel.
>>> 
>>> _______________________________________________
>>> ceph-users mailing list
>>> ceph-users@xxxxxxxxxxxxxx
>>> http://lists.ceph.com/listinfo.cgi/ceph-users-ceph.com
>>> 
>> 
>> _______________________________________________
>> ceph-users mailing list
>> ceph-users@xxxxxxxxxxxxxx
>> http://lists.ceph.com/listinfo.cgi/ceph-users-ceph.com
> 
> _______________________________________________
> ceph-users mailing list
> ceph-users@xxxxxxxxxxxxxx
> http://lists.ceph.com/listinfo.cgi/ceph-users-ceph.com
> 

_______________________________________________
ceph-users mailing list
ceph-users@xxxxxxxxxxxxxx
http://lists.ceph.com/listinfo.cgi/ceph-users-ceph.com

[Index of Archives]     [Information on CEPH]     [Linux Filesystem Development]     [Ceph Development]     [Ceph Large]     [Linux USB Development]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [xfs]


  Powered by Linux