How to create Live Windows Recovery Environment(LiveRE) on a USB Flash Drive

The LiveRE tool can be used to troubleshoot booting issues. It contains PowerShell command-line tools that can be used to do various tasks that is not available in the traditional Windows Recovery Environment.

Diskpart tool will be used to delete existing partitions in the USB flash drive and create a new partition in it. User need to be very careful using the Command line tools because it may lead to data loss if not used correctly.

Format command is used to format the volume in USB flash drive.

dism command is used to apply LiveRE.wim image file to USB flash drive.

General Considerations:

  1. Run PowerShell or Command prompt in Administrator mode.

    2. Command to Run Diskpart tool.

    • diskpart

    3. Command to show the list of disks.

    • list disk

    Note down the disk index number of the USB Flash drive.

    4. Syntax to select the disk using index number.

    • Syntax: select disk =<disk index number>

    In this case it is disk index number 2.

    Command to select the disk with index number 2.

    • select disk=2

    5. Command to Removes all existing partitions in the selected disk.

    • clean

    6. The next task is to convert the disk to GPT type if it is not already.

    Command to convert the disk to GPT type.

    • convert gpt

    7. The next task is to create a primary partition is the USB flash drive and a FAT32 file system is required. Microsoft limits the maximum FAT32 to 32 GB.

    Command to create primary partition in USB Flash drive of size upto 32 GB.

    • create partition primary

    Command to create primary partition in USB Flash drive of size greater than 32 GB.

    • create partition primary size=32000

    8. Command to show the list of disks and show the selected disk with * mark.

    • list disk

    9. Command to show the list of partitions in the selected disk.

    • list partition

    10. The next task is to list the volumes.

    Note down the volume letter of the USB Flash Drive. in this case the Volume letter for the partition in USB flash Drive is G.

    Command to show the list of volumes.

    • list volume

    11. Command to exit the Diskpart tool

    • exit

    12. The next task is to format the volume in the USB flash drive with FAT32 file system.

    Syntax for Format command.

    • FORMAT volume [/FS:file-system] [/V:label] [/Q]
      • volume : Specifies the drive letter (followed by a colon),mount point, or volume name.
      • /FS:filesystem : Specifies the type of the file system (FAT, FAT32, exFAT,
      • NTFS, UDF, ReFS).
      • /V:label : Specifies the volume label.
      • /Q : Performs a quick format. Note that this switch overrides /P.

    Command to quick format the volume with drive letter G with FAT32 file system and assign a volume label of “LiveRE“.

    • format G: /FS:FAT32 /V:LiveRE /Q

    13. The next task is to apply the Live Windows Recovery Environment(LiveRE) image file to the partition is USB Flash Drive.

    Syntax:

    • dism /Apply-Image /ImageFile:<complete path of the LiveRE.wim> /Index:1 /ApplyDir:<flash drive letter>:\

    In this case,

    • complete path of the LiveRE.wim file is : “C:\Windows LiveRE\liveRe.wim”
    • flash drive letter : G

    Command to apply LiveRE image file to the Volume in USB flash drive with Drive Letter G.

    • dism /Apply-Image /ImageFile:”C:\Windows LiveRE\liveRe.wim” /Index:1 /ApplyDir:G:\

    Function:

    • This command uses the Deployment Image Servicing and Management (DISM) tool to apply a Windows image (liveRe.wim) to the G: drive.
    • /Index:1 specifies that the first image within the liveRe.wim file should be applied.
    • /ApplyDir:G:\ designates the target directory for the image application.

    14. The next step is to use BCDBoot tool to create a Boot Configuration Data (BCD) store on the partition in USB Flash Drive.

    bcdboot Syntax

    • <flash drive letter>:\Windows\System32\bcdboot <flash drive letter>:\Windows /s <flash drive letter>: /f ALL

    Command to create Boot Configuration Data (BCD) store on the G drive in USB Flash Drive.

    • G:\Windows\System32\bcdboot G:\Windows /s G: /f ALL