Today I have noticed that when I push the rear brake lever (hydraulic disc brakes) the rotor is a little bit bending , but it wasn't rubbing the caliper . I came to a conclusion that rotor is not centered in the caliper , and I tried to center it . I took the pads out , pushed the pistons , installed the pads back and even if I push the caliper all the way into the frame there is very little space between the inside pad and the rotor , and very big between the outside. How can I solve this problem so that the rotor stands right in the middle of the caliper , I think this will also improve the braking power. I though to put some spacers between the frame and the rear adapter , but I am not sure if it is a good idea or no.
Depending on your brakes and their design, you may not want the rotor centered.
If both pads move when the lever is squeezed, then center position is correct. However, if you have one fixed pad and one pad that moves you want the rotor to be as close as possible to the fixed pad (without touching/rubbing) so that it bends the least when the one moving piston is engaged.
Most brake manufacturers design their brake calipers with slotted grooves so that the brake unit can be adjusted. Some Magura breaks are an exception to this and require you to adjust the rotor with spacers. However, for most disc brakes, if you have the proper adapter and true rotor, these slots should be all you need to adjust the unit properly.