Where a lien is on an undivided interest or estate of any of the parties and a partition is made, the lien is then only upon the share assigned to that party, but the share shall first be charged with its just proportion of the costs of the partition, in preference to the lien.