Map Physical Drives to Letters in UEFI Shell
This guide outlines how system administrators can inspect, assign,
and manage logical drive mappings for physical storage devices within
the Unified Extensible Firmware Interface (UEFI) Shell. By leveraging
the built-in map command and hardware device paths,
administrators can associate raw block devices or recognized file
systems with persistent or custom drive designations (such as
FS0:, FS1:, or user-defined aliases), enabling
direct file operations and recovery tasks outside the operating
system.
Understanding UEFI Drive Handle Types
The UEFI Shell classifies storage interfaces into two primary categories:
- Block Devices (
BLKx:): Represent raw, unformatted physical drives, disks, or individual partitions (e.g.,BLK0:,BLK1:). - File Systems (
FSx:): Represent partitions formatted with a file system natively recognized by UEFI (typically FAT16 or FAT32, and occasionally NTFS or EXT through vendor-specific drivers).
Step 1: List Current Mappings and Hardware Paths
Open the UEFI Shell and execute the map command to
display all currently detected storage devices alongside their assigned
logical handles and hardware device paths:
map -v
The -v (verbose) flag displays the complete UEFI Device
Path for each device.
To identify which physical drive corresponds to a logical handle, inspect the device path string:
- SATA Drives: Contain identifiers such as
Ata(...)orSata(...). - NVMe Drives: Contain identifiers such as
NVMe(...). - USB Drives: Contain identifiers such as
USB(...).
If a newly connected drive does not appear, refresh the device list by running:
map -r
Step 2: Assign a Custom Logical Drive Letter
To map a physical block device or an existing file system handle to a custom logical drive name, use the following syntax:
map <Name>: <TargetDevice>
For example, to map the first recognized file system
(FS0:) to a logical drive named SYSTEM::
map SYSTEM: FS0:
To map a raw block device partition (for example, BLK2:)
directly to a new file system handle called FS5::
map FS5: BLK2:
Once mapped, you can switch to the drive by typing its name followed by a colon:
SYSTEM:
ls
Step 3: Delete an Existing Mapping
If a logical letter needs to be reassigned or removed, use the
-d flag:
map -d SYSTEM:
Step 4: Automate Mappings on Boot
Manual mappings created in an active UEFI Shell session are temporary and clear upon system reboot. To make custom drive mappings persistent:
Navigate to the boot drive's root directory:
FS0:Create or edit the
startup.nshscript:edit startup.nshAdd your custom mapping commands to the file:
map -r map USBDATA: FS1:Press
Ctrl + Sto save andCtrl + Qto exit the editor.
The UEFI Shell automatically executes startup.nsh upon
launch, ensuring physical devices map to your preferred logical drive
labels automatically.