Pullbacks of canonical divisors along branched maps Let $f\colon X \to Y$ be a finite map of smooth surfaces. Let the divisor $D$ of $Y$ be the branch locus of $f$. We assume that $D$ is a union of nonsingular curves intersecting transversally with no three components meeting at one point.
Claim: 
$2K_X = f^*(2K_Y + D),$ 
where $K_X$ is the canonical divisor of $X$ and $K_Y$ is the same for $Y$. 
How do you prove this claim?
 A: I am not sure your formula is quite correct, I'm worried about those $2$'s. A correct formula is $K_X = f^*(K_Y)+R$ where $R$ is the ramification divisor, which is a divisor on $X$ with same support as $f^*(D)$. The proof is similar to the proof of Hurwitz's formula for curves. Pull-back a differential two-form from $Y$ to $X$ and compute divisors on both surfaces. I think you can find the result in Iitaka's book but I don't have it with me at the moment, so I can't check.
A: As Felipe and Karl correctly pointed out, the formula you write is not true in general. However, if you read Vakil's paper, you see that  he's considering a very particular situation, namely Galois coverings with Galois group $G=(\mathbb{Z}_p)^3$, where $p=2,3$. 
Let me explain how the formula works in a simpler case, namely $G=(\mathbb{Z}_2)^2$, the so-called bidouble covers (see Catanese' paper [Ca1] in Vakil bibliography). Then you can try to prove it in Vakil's cases (maybe after reading Pardini's paper on abelian covers).
Let us call $\chi_i$, $i=1,2,3$ the three non-trivial characters of $G$. Then the branch locus $D$ of $f$ can be written as
$D=D_1 + D_2 +D_3$,
where $D_i$ correspond to $\chi_i$. The divisors $D_i$ are smooth and intersect transversally.
Now we can factor $f$ as
$X \stackrel{g}{\longrightarrow} Z \stackrel{h}{\longrightarrow} Y$,
where $h$ and $g$ are double covers branched over $D_1+D_2$ and $h^*D_3$, respectively. Note that in general the intermediate cover $Z$ is singular!
By using the formulae for double covers, we can write
$2K_Z=h^*(2K_Y+D_1+D_2), \quad 2K_X=g^*(2K_Z+h^*D_3)$
that is, putting things together,
$2K_X=g^*h^*(2K_Y+D_1+D_2+D_3)=f^*(2K_Y+D)$.
A: Felipe is right.  $K_X = f^* K_Y + R$.  Thus 
$$2K_X = 2(f^*K_Y + R).$$
However, your formula might still be right depending on the context.  If $X \to Y$ is a 2-to-1 cover with tame ramification, then the ramification index at each component of $R$ is $2$.  Thus $2R = f^* D$.
Plugging this in you get:
$$2K_X = 2f^*K_Y + 2R = f^*(2K_Y + D).$$
That's exactly what you wanted, and might be what's going on in your particular situation.
However, if your cover is 3-1 (characteristic $\neq 3$) and for simplicity if we assume that the ramification index at each component of the ramification divisor is 3 , then $R = (3-1)\text{Supp}(R) = 2\text{Supp}(R)$.  It follows that $f^* D = 3 \text{Supp}(R) = (3/2)R$.  Therefore
$$2K_X = f^*2K_Y + 2R = f^*2K_Y +(4/3)f^*D = 
f^*2K_Y + 4 \text{Supp}(R) .$$
Which is not what you want.
