The usual remedy in a partition action, absent an agreement to the contrary by the parties, is for the court to order the property sold at a sheriff's sale that is basically identical to a foreclosure sale (assuming that the property cannot feasibly be physically divided in kind into two separate useable parcels of equal value). A lienholder of record is a necessary party to a partition action.
A lien, in this sense of the word, is any debt obligation for which the property is collateral, regardless of whether it is a mortgage, a deed of trust, a mechanic's lien, a judgment lien, a property tax lien, a tax lien, etc.
If the sale produces less than the outstanding debt, then the lienholder receives all of the proceeds, less the costs of sale, and the lender can secure a deficiency judgment for the balance owed against the people obligated on the underlying debt.
Usually, everyone obligated on the debt would be jointly and severally liable, and would have a right to contribution from the other people obligated on the deficiency judgment if that person ends up paying more than their share of the deficiency judgment to the creditor.