  We study the surface barrier for magnetic field penetration in mesoscopic
samples of both type I and type II superconductors. Our results are obtained
from numerical simulations of the time-dependent Ginzburg-Landau equations. We
calculate the dependence of the first field for flux penetration ($H_p$) with
the Ginzburg-Landau parameter ($\kappa $) observing an increase of $H_p$ with
decreasing $\kappa$ for a superconductor-insulator boundary condition ($(\nabla
-iA)\Psi|_n=0$) while for a superconductor-normal boundary condition
(approximated by the limiting case of $\Psi|_S=0$) $H_p$ has a smaller value
independent of $\kappa$ and proportional to $H_c$. We study the magnetization
curves and penetration fields at different sample sizes and for square and thin
film geometries. For small mesoscopic samples we study the peaks and
discontinuous jumps found in the magnetization as a function of magnetic field.
To interpret these jumps we consider that vortices located inside the sample
induce a reinforcement of the surface barrier at fields greater than the first
penetration field $H_{p1}$. This leads to multiple penetration fields $H_{pi} =
H_{p1}, H_{p2}, H_{p3}, ...$ for vortex entrance in mesoscopic samples. We
study the dependence with sample size of the penetration fields $H_{pi}$. We
explain these multiple penetration fields extending the usual Bean-Livingston
analysis by considering the effect of vortices inside the superconductor and
the finite size of the sample.
