Boundary effects on flux penetration in disordered superconductors