
214 Cal.App.3d 387 (1989)
264 Cal. Rptr. 1
JOSEPH A. SONGER, Plaintiff and Appellant,
v.
FRANCIS M. COONEY et al., Defendants and Respondents; LAWRENCE BORDAN, Real Party in Interest.
Docket No. B034674.
Court of Appeals of California, Second District, Division Six.
June 14, 1989.
*389 COUNSEL
Gregory D. Abel, W. Peter Terhune and Wendt, Ronca & Woolpert for Plaintiff and Appellant.
James B. Lindholm, Jr., County Counsel, and Warren R. Jensen, Deputy County Counsel, for Defendants and Respondents.
Lawrence M. Bordan, in pro. per., for Real Party in Interest.
OPINION
ABBE, J.
Appellant Joseph A. Songer appeals a judgment dismissing his petition for a writ of mandate to compel respondent Francis M. Cooney, Clerk-Recorder for the County of San Luis Obispo (clerk), to issue a writ of execution and to compel respondent George Whiting, Sheriff of the County of San Luis Obispo (sheriff), to levy upon certain property of the real party in interest Lawrence Bordan.
(1a), (2a) The questions presented on appeal are whether a judgment lien on real property perfected prior to the judgment debtor's bankruptcy survives the debtor's discharge in bankruptcy, and, if so, whether a writ of execution is available to enforce the lien. We answer both questions in the affirmative, and reverse.

FACTS
On July 23, 1981, Songer obtained a judgment against Bordan in the amount of $308,000. The next day an abstract of judgment was recorded in San Luis Obispo County, thus perfecting a judgment lien against all the real property belonging to Bordan in the county. (Code Civ. Proc., §§ 697.310 and 697.340.)
In February of 1982, having obtained a writ of execution, Songer initiated proceedings to execute upon certain real property belonging to Bordan. On March 3, 1982, before the sheriff's sale could take place, Bordan filed for relief under chapter 11 of the Bankruptcy Code, thus automatically staying any action to enforce the judgment. (11 U.S.C. § 362(a).)
At some point Bordan's bankruptcy was converted to chapter 7, and on March 19, 1985, Bordan received an order of discharge from the bankruptcy court.
*390 After Bordan received the bankruptcy discharge, Songer requested the sheriff to proceed under the original writ of execution. The sheriff refused on the basis that the writ had expired during Bordan's bankruptcy.
On September 12, 1985, Songer applied to the superior court for an ex parte order directing the clerk to issue a new writ of execution.
By minute order dated October 10, 1985, the court denied the application on the ground that the judgment had been discharged in bankruptcy and was not enforceable.
Notwithstanding the order denying the application for the ex parte order Songer applied to the clerk for a new writ. The clerk responded by letter that in light of the minute order no writ of execution would be issued.
On May 22, 1986, Songer filed the instant petition for writ of mandate on the basis that the bankruptcy order discharged Bordan from personal liability only, and that the judgment lien perfected by recording the abstract of judgment remained after the discharge. The petition asked that the court require the clerk to issue a writ of execution and the sheriff to levy upon the real property described in the writ of execution.
After a hearing the court found that neither the personal judgment nor the judgment lien was enforceable after bankruptcy. The court sustained Bordan's demurrer for failure to state a cause of action without leave to amend, and a judgment of dismissal was entered. The court also gave the clerk and the sheriff judgment on the pleadings.

DISCUSSION
(3) The function of a demurrer is to test the sufficiency of a pleading by raising questions of law. (Postley v. Harvey (1984) 153 Cal. App.3d 280, 286 [200 Cal. Rptr. 354].) In assessing the sufficiency of a demurrer, all facts pleaded in the complaint must be deemed true. (Holland v. Thacher (1988) 199 Cal. App.3d 924, 928 [245 Cal. Rptr. 247].) If upon consideration of all the facts stated it appears that the plaintiff is entitled to any relief, the complaint will be held good. (Chase Chemical Co. v. Hartford Accident & Indemnity Co. (1984) 159 Cal. App.3d 229, 242 [205 Cal. Rptr. 469].)
(4) A motion for judgment on the pleadings is in the nature of a demurrer. (Megeff v. Doland (1981) 123 Cal. App.3d 251, 257, fn. 1 [176 Cal. Rptr. 467].)


*391 I.

Survival of Judgment Lien
A discharge in bankruptcy "voids any judgment at any time obtained, to the extent that such judgment is a determination of the personal liability of the debtor...." (11 U.S.C. § 524(a)(1).)
(1b) "Generally, valid, perfected judicial liens which precede bankruptcy survive and are enforceable after bankruptcy.... The bankruptcy discharge does not prevent post-petition enforcement of valid liens. The secured creditor may proceed to enforce the lien, as an in rem action, and is not barred by the injunctive terms of 11 U.S.C. § 524." (In re Hermansen (B.C.D.C. Colo. 1988) 84 B.R. 729, 733 [18 C.B.C.2d 952].)
In other words, a discharge in bankruptcy voids a judgment only to the extent of the debtor's personal liability. A discharge does not affect a judgment to the extent that it supports a lien perfected prior to bankruptcy. As to such liens the judgment remains valid and enforceable after discharge.
(5) An exception to the general rule of survivability of liens arises where the debtor has obtained an order in the bankruptcy proceeding avoiding the lien.
Thus a debtor may avoid a judicial lien to the extent that it impairs an exemption. (11 U.S.C. § 522(f).) For example, a judgment lien can be avoided to the extent of a homestead exemption. (See In re Hermansen, supra, 84 B.R. at pp. 732-733.)
In addition a judgment is secured only to the value of the debtor's interest in the property, and to the extent that the judgment exceeds the value of the debtor's equity it is unsecured. (11 U.S.C. § 506(a).) The debtor may request in bankruptcy that the unsecured portion of the judgment creditor's claim be disallowed (11 U.S.C. § 502), and to the extent that the claim is disallowed the lien is void. (11 U.S.C. § 506(d).)
(1c) If the proper procedures are followed, a judgment lien may survive bankruptcy to the extent of the debtor's equity in the property, if any, as determined in bankruptcy, less any exemption. The debtor will be entitled to any increase in equity which occurs after the discharge in bankruptcy.
However, in an affidavit attached to Songer's petition for writ of mandate his attorney declared on information and belief that no action to avoid the lien was taken by Bordan in the bankruptcy court. For the purpose of determining whether the trial court erred in sustaining Bordan's demurrer and granting respondents' motion for judgment on the pleadings, we must assume that is true. (Holland v. Thacher, supra, 199 Cal. App.3d at p. 928; *392 Megeff v. Doland, supra, 123 Cal. App.3d at p. 257, fn. 1.) Therefore we must assume that the judgment lien survived bankruptcy in its entirety,[1] and are required to reverse.
Bordan and respondents cite Code of Civil Procedure[2] section 697.010 which provides in part that "... a lien created under this division ... is a lien for the amount required to satisfy the money judgment." They argue that because the judgment was discharged in bankruptcy, the amount required to satisfy the lien is zero, and therefore, the lien has been extinguished.
However, the argument misses the point that only personal liability on the judgment was discharged in bankruptcy. To the extent that the lien has not been avoided in bankruptcy, liability on the judgment remains in rem and the surviving portion of the judgment must be paid in order to extinguish the lien.
Similarly Bordan and respondents cite section 697.030 which provides in part that "... a lien created pursuant to this title is effective during the period of enforceability of the judgment," and they argue that the judgment is not enforceable after discharge.
However, the judgment remains enforceable in rem even though the judgment debtor no longer has any personal liability.
Bordan's and respondents' reliance on Bulmash v. Davis (1979) 24 Cal.3d 691 [157 Cal. Rptr. 66, 597 P.2d 469], is misplaced. In that case the court vacated the judgment, and held that a judgment lien "... cannot exist apart from the judgment upon which it is based. Thus in the ordinary course of events when the judgment is vacated by court order the lien will also cease to exist, because the effect of the vacating order is to eliminate the judgment." (Id., at p. 697.)
In the instant case, absent an order from the bankruptcy court avoiding the lien in its entirety the judgment was not vacated but remained enforceable in rem to the extent necessary to support the lien.

II.

Availability of Writ of Execution to Enforce Judgment Lien
(2b) Bordan and respondents cite section 699.010 et seq. for the proposition that writs of execution are available to enforce "money judgments," *393 and they argue that there is no authority for the use of such writs to enforce judgment liens. We disagree.
A judgment lien on real property is created by recording an abstract of a money judgment with the county recorder. (§ 697.310, subd. (a).)
"[T]he usual and ordinary method of enforcement of a judgment lien is by execution sale.... An equitable action to foreclose the judgment lien is not required." (Corporation of America v. Marks (1937) 10 Cal.2d 218, 220 [73 P.2d 1215, 114 A.L.R. 1162].)
We see no reason to depart from the usual rule in the instant case. The fact that personal liability on the judgment has been discharged in bankruptcy should not affect the method of enforcing the judgment lien.
Finally there is no merit to Bordan's and respondents' contention that the levying officer was required to return the writ under section 699.560 subdivision (a)(5) because the time for enforcement of the money judgment had expired by virtue of Bordan's discharge in bankruptcy.[3]
As we have stated, a discharge in bankruptcy does not necessarily bar enforcement of a preexisting judgment lien, and therefore, the time for enforcement of the judgment in rem had not expired by virtue of the discharge.
The judgment of the trial court is reversed. The real party in interest is to bear appellant's costs on appeal. Respondents clerk and sheriff are to bear their own costs on appeal.
Stone (S.J.), P.J., and Gilbert, J., concurred.
NOTES
[1]  Of course this assumption is only for the purpose of reviewing the trial court's action in sustaining the demurrer and granting judgment on the pleadings. Whether the lien was avoided in bankruptcy is a question of fact which must be determined on remand.
[2]  All further references are to this code unless otherwise indicated.
[3]  Section 699.560 provides in part: "(a) ... the levying officer to whom the writ of execution is delivered shall return the writ to the court ... at the earliest of the following times: [¶].... [¶] (5) Upon expiration of the time for enforcement of the money judgment."
