<PAGE>

                                                                   Exhibit 10.31
                           [Letterhead of LEXAR MEDIA]

October 22, 2001


Mr. Eric Stang
[Address]


Dear Mr. Stang:

This retention agreement (the "Retention Agreement") will set forth the binding
agreement of employment effective as of September 1, 2001 regarding your
employment with Lexar Media, Inc. ("LEXAR MEDIA"). As used in this Retention
Agreement, "LEXAR MEDIA" shall refer to Lexar Media, Inc, or the surviving
entity in a Corporate Transaction. You acknowledge and agree that this Agreement
supersedes the terms set forth in your Employment Agreement dated October 20,
1999 or any other agreement whether oral or written to the extent inconsistent
with the terms of this Retention Agreement. You specifically acknowledge and
agree that the Lexar Media Inc. Employee Nondisclosure and Invention Assignment
Agreement dated November 8, 1999 remains in full force and effect.

1.   PAYMENTS AND BENEFITS AFTER INVOLUNTARY TERMINATION OR CONSTRUCTIVE
     TERMINATION EVENT IN THE ABSENCE OF A CORPORATE TRANSACTION

Except during a Post Transaction Period as provided in Section 2 below,
following involuntary termination by Lexar Media other than for Cause (as
defined below) or a voluntary resignation by you following a Constructive
Termination Event (as defined below) by LEXAR MEDIA you will receive:

     (a)  Your base salary in effect at the time of such termination continued
          for twelve (12) months;

     (b)  Medical insurance and life insurance at the levels in effect at the
          time of such termination for twelve (12) months;

     (c)  Your annual target bonus of fifty (50) percent of your salary paid as
          a lump sum at the end of the fiscal year and pro-rated up to the date
          of termination for the period you were eligible for any such bonus;
          provided that you will receive payment under this Section 1(c) only if
          you would have earned such bonus absent your termination, the
          determination of which will reflect and not be inconsistent with the
          level of bonus payments made to others for the same period;

     (d)  All stock options or restricted stock which have been granted to you
          on or before September 1, 2001 shall become 100% vested, followed by a
          twelve (12) month period during which such options may be exercised,
          but in no event may such option be exercised after ten (10) years from
          the original grant of the option;

     (e)  An additional twenty-four (24) months vesting of any stock options
          granted to you

                                       -1-

<PAGE>

          by LEXAR MEDIA after September 2, 2001; all stock options or
          restricted stock which have been granted to you on or before September
          1, 2001 shall become 100% vested, followed by a twelve (12) month
          period during which such options may be exercised;

     (f)  No further continuance of other benefits such as vacation, sick leave,
          and employee stock purchase plan participation, unless specified
          herein;

     (g)  Eighteen (18) months in which to repay the principal and interest on
          any notes that you have with LEXAR MEDIA; and

     (h)  Any cellular phone, notebook computer and camera equipment as then
          currently provided to you.

Notwithstanding any provisions in this Section 1 to the contrary, you shall not
be entitled to the payments and benefits under Section 1 above unless you (i)
have executed a general release (in a form prescribed by LEXAR MEDIA) of all
known and unknown claims that you may then have against LEXAR MEDIA or persons
affiliated with LEXAR MEDIA and (ii) have agreed not to prosecute any legal
action or other proceeding based upon any of such claims.

2.   PAYMENTS AND BENEFITS AFTER TERMINATION OF EMPLOYMENT FOLLOWING A CORPORATE
     TRANSACTION

If at any time during the Post Transaction Period (as defined below) there is an
involuntary termination of your employment other than for Cause (as defined
below) or you voluntarily resign following a Constructive Termination Event (as
defined below), then you will receive:

     (a)  Your base salary in effect at the time of such termination continued
          for fifteen (15) months;

     (b)  Medical and life insurance at the levels in effect at the time of
          termination for fifteen (15) months;

     (c)  Your annual target bonus of fifty (50) percent of your salary paid as
          a lump sum and pro-rated up to the date of termination for the period
          you were eligible for any such bonus but regardless of whether you
          would have earned such bonus prior to your termination;

     (d)  All stock options or restricted stock which have been granted to you
          or purchased by you subsequent to a corporate transaction shall become
          100% vested, followed by a six (6) month period during which such
          options may be exercised, but in no event may such option be exercised
          after ten (10) years from the original grant of the option;

     (e)  No further continuance of other benefits such as vacation, sick leave,
          and employee stock purchase plan participation, unless specified
          herein;

     (f)  Eighteen (18) months in which to repay the principal and interest on
          any notes that you have with LEXAR MEDIA; and

                                       -2-

<PAGE>

     (g)  Any cellular phone, notebook computer and camera equipment as then
          currently provided to you.

3.   PAYMENTS AND BENEFITS FOLLOWING A CORPORATE TRANSACTION

If at any time, a Corporate Transaction (as defined below) occurs, and you
remain an employee of LEXAR MEDIA through the completion of the Corporate
Transaction, then you shall receive the following:

     (a)  A cash bonus of two hundred and sixty thousand dollars ($260,000);

     (b)  Immediately upon the occurrence of a Corporate Transaction, twenty-
          five percent (25%) of all unvested stock options and restricted stock
          which were previously granted to you shall become 100% vested
          immediately preceding such Corporate Transaction and shall (i) remain
          exercisable pursuant to the terms of the original grant agreement or
          (ii) be followed by a six (6) month period during which such options
          may be exercised, whichever period is greater. The remaining
          seventy-five percent (75%) of all stock options and restricted stock
          which were previously granted to you prior to the Corporate
          Transaction shall become vested nine (9) months after the completion
          of the Corporate Transaction and shall (i) remain exercisable pursuant
          to the terms of the original grant agreement or (ii) be followed by a
          six (6) month period during which such options may be exercised,
          whichever period is greater.

4.   DEATH OR DISABILITY

If you die or are unable to perform your work because of disability, all stock
options which were granted to you shall become 100% vested as of the date of
such occurrence and shall be exercisable pursuant to the terms of your stock
option agreement.

5.   DEFINITIONS

For purposes of this letter, the following definitions shall apply:

     (a)  A "Corporate Transaction" is defined as (i) a merger or acquisition
          in which LEXAR MEDIA is not the surviving entity (except for a merger
          of LEXAR MEDIA into a wholly-owned subsidiary, and except for a
          transaction the purpose of which is to change the State in which LEXAR
          MEDIA is incorporated), (ii) the sale, transfer or other disposition
          of all or substantially all of the assets of LEXAR MEDIA, or (iii) any
          other corporate reorganization or business combination in which the
          beneficial ownership of 50% or more of LEXAR MEDIA's outstanding
          voting stock is transferred.

     (b)  The "Post Transaction Period" is defined as commencing one month prior
          to the date of closing or effectiveness of a Corporate Transaction and
          continuing for eighteen (18) months following such date.

     (c)  A "Constructive Termination Event" will be deemed to have occurred at
          the close of business on the fourteenth (14th) day after any of the
          following action(s) are

                                       -3-

<PAGE>

          taken by LEXAR MEDIA or the surviving entity or parent corporation in
          a Corporate Transaction and such action(s) are not reversed in full by
          LEXAR MEDIA or the surviving entity of a Corporate Transaction within
          such fourteen-day (14) period unless prior to the expiration of such
          fourteen-day (14) period you have otherwise agreed to the specific
          relevant event in writing: (i) your aggregate benefits are materially
          reduced (as such reduction and materiality are determined by customary
          practice within the high technology industry within the State of
          California) below those in effect immediately prior to the effective
          date of such Constructive Termination Event, and/or (ii) your duties
          and/or authority are materially decreased or increased from those in
          effect immediately prior to the effective date of such Constructive
          Termination Event, including but not limited to: (a) your no longer
          acting as the top executive of LEXAR MEDIA with the title of President
          and Chief Executive Officer; (b) your no longer having direct
          management responsibility for all corporate functions as an officer of
          LEXAR MEDIA, including all engineering and product development,
          marketing, sales, manufacturing, finance, HR and legal activities of
          LEXAR MEDIA; (c) your no longer reporting directly to the Board of
          Directors of LEXAR MEDIA and to an executive officer of any successor
          or parent corporation of LEXAR MEDIA following a Corporate
          Transaction; or (d) your no longer serving as a member of the Board of
          Directors of Lexar Media, in any case regardless of whether LEXAR
          MEDIA is a separate entity or a division of another entity following a
          Corporate Transaction; or (iii) your being required to perform your
          employment obligations (other than routine travel consistent with that
          prior to the effective date of such Constructive Termination Event) at
          a location more than twenty-five (25) miles away from your principal
          place of work as was in effect immediately prior to the effective date
          of such Constructive Termination Event.

    (d)   "Cause" is defined as (i) willful misconduct in the performance of
          your duties to the LEXAR MEDIA that has resulted or is likely to
          result in substantial and material damage to Company; (ii) commission
          of any act of fraud with respect to the LEXAR MEDIA; or (iii)
          conviction of a felony or a crime involving moral turpitude causing
          material harm to the business and affairs of the LEXAR MEDIA. No act
          or failure to act by you shall be considered "willful" if done or
          omitted by Employee in good faith with reasonable belief that such
          action or omission was in the best interests of the LEXAR MEDIA.

6.   MISCELLANEOUS

     (a)  As LEXAR MEDIA's relationship with employees is at-will, either you or
          LEXAR MEDIA may terminate the employment relationship at any time for
          any reason, with or without notice.

     (b)  In the event of a dispute arising under or related to this letter,
          including any termination of your employment under this letter, you or
          LEXAR MEDIA may initiate for arbitration under the arbitration under
          the administration of the American Arbitration Association ("AAA").
          Any arbitration hearing will be held in the vicinity of the LEXAR
          MEDIA location where you last performed services and will be held in
          accordance with the Employee Dispute Resolution rules of the

                                       -4-

<PAGE>

          AAA, within 60 calendar days of such filing or as may be extended upon
          the consent of the parties or their counsel. The arbitration shall be
          binding on both parties and may be entered as a judgment in any court
          of competent jurisdiction. Each party shall bear its own costs of
          arbitration including attorneys fees, unless you prevail in whole or
          in part, in which case LEXAR MEDIA will pay your costs of arbitration
          including reasonable attorney fees, pro-rated to the extent you
          prevail, and such shall be part of the award in the arbitration.

     (c)  If, due to the benefits provided under this Agreement, you are subject
          to any excise tax due to the characterization of any amounts payable
          hereunder as excess parachute payments pursuant to Section 4999 of the
          Internal Revenue Code, the Company agrees to "gross-up" the amount
          payable to you such that the net amount realizable by you is the same
          as if there was no such excise tax; provided, however, that the amount
          of gross-up will not exceed $150,000. Notwithstanding the foregoing,
          however, upon a Corporate Transaction, you may elect in your sole
          discretion, not to have any portion of such options or restricted
          stock vest in order to avoid any "excess parachute payment" under
          Section 280G(b)(1) of the Internal Revenue Code of 1986, as amended.

     (d)  The provisions of this letter will be governed and construed with the
          laws of the State of California.

Agreed and Accepted:                              Sincerely,

                                                  /s/ Brian Jacobs

/s/ Eric B. Stang                                 Brian Jacobs
----------------------------------------
Eric B. Stang                                     Board Member

                                       -5-