Understanding and Removing Raw Device Mapping (RDM) from Your Virtual Machine
If you're managing virtual machines (VMs) in a VMware environment, you might encounter Raw Device Mapping (RDM) disks. While RDMs offer certain advantages, such as direct access to storage and the ability to use storage features like snapshots, there are times when you might need or want to remove them. This article will guide you through the process of removing RDM from your VM, explaining why you might do so and the steps involved.
What is Raw Device Mapping (RDM)?
Before we dive into removal, let's quickly define RDM. In VMware, RDM is a method of presenting a physical storage device (like a LUN from a storage array) directly to a virtual machine. Unlike a virtual disk (VMDK), which is a file stored on a datastore and abstracts the underlying storage, an RDM bypasses this abstraction layer. This can be beneficial for applications that require direct disk access or specific hardware features.
Why Would You Want to Remove an RDM?
There are several common reasons why a user might decide to remove an RDM from their VM:
- Simplification: Managing virtual disks (VMDKs) is generally simpler. They are files within the datastore, making them easier to back up, clone, and manage with VMware's built-in tools.
- Migration to Virtual Disks: Often, the initial need for RDM is no longer present, and migrating to VMDKs can streamline operations and improve compatibility with various VMware features.
- Storage Consolidation: You might be consolidating your storage infrastructure and want to bring all VM data into VMDK files residing on a central datastore.
- Snapshots and Backups: While RDMs can be snapshotted, managing VMDKs with snapshots and backups is often more straightforward and widely supported by third-party backup solutions.
- Resource Management: In some cases, migrating away from RDMs can simplify resource allocation and management within your virtual environment.
How to Remove an RDM from Your VM
Removing an RDM from a VMware VM involves a few key steps. It's crucial to perform these steps carefully to avoid data loss.
Important Pre-Removal Considerations:
Backup Your Data: Before you begin any storage modifications, it is absolutely critical to perform a full backup of your VM and its data. This is your safety net in case anything goes wrong.
Identify the RDM: You need to know which disk in your VM is the RDM. You can usually identify this by looking at the VM's settings in vSphere Client or VMware Workstation/Fusion. RDMs will appear as "Raw Device Mappings" or similar, often referencing a specific LUN ID.
Understand the Data on the RDM: Ensure you know what data resides on the RDM and whether it's critical. If the RDM contains the VM's operating system or essential applications, you'll need to plan for migrating that data.
Step-by-Step Removal Process:
The process generally involves detaching the RDM from the VM and then migrating any data to a new virtual disk.
- Shut Down the Virtual Machine: Before making any changes to the VM's hardware configuration, it is essential to shut down the VM completely. Do not suspend or put it in a sleep state.
-
Edit the Virtual Machine Settings:
- In vSphere Client (for ESXi/vCenter): Right-click on the VM, select "Edit Settings."
- In VMware Workstation/Fusion: Select the VM, then go to "VM" > "Settings."
- Locate the RDM Disk: In the VM settings window, you will see a list of the VM's virtual hardware. Find the entry that corresponds to your RDM disk. It will typically be labeled as a SCSI device and will mention "Raw Device Mapping" or "RDM." Note the SCSI ID (e.g., SCSI 0:1).
-
Remove the RDM from the VM:
- Select the RDM disk.
- Click the "Remove" or "X" button next to it.
- You will likely be presented with an option to "Remove from virtual machine" or "Delete from disk." Crucially, select "Remove from virtual machine." Do NOT choose "Delete from disk" as this will erase the data on the physical LUN.
-
Add a New Virtual Disk (if necessary): If the RDM contained data that you need to keep and use within the VM, you will need to add a new virtual disk.
- Click "Add New Device" or the "+" button.
- Select "Hard Disk."
- Configure the new virtual disk. You'll choose its size and whether it should be a thick or thin provisioned disk.
- Crucially, ensure this new virtual disk is created on a datastore that can accommodate its size and your performance needs.
-
Migrate Data to the New Virtual Disk: This is the most critical part if the RDM held important data.
- Start the VM.
- Once the operating system boots, you will need to copy the data from the RDM (which is now detached but still accessible at the OS level if it wasn't the boot disk) to the newly created virtual disk.
- If the RDM was the boot disk, you will need to reinstall the operating system on the new virtual disk and then restore your applications and data from your backup.
- Alternatively, you can use tools like `vmkfstools` (on ESXi) or other disk imaging/cloning utilities within the guest OS to copy the contents of the RDM to the new VMDK.
Example of data migration within the guest OS: If the RDM was mounted as drive D: in Windows and you added a new virtual disk as E:, you would open File Explorer and copy all files and folders from D: to E:.
- Verify Data Integrity: After migrating the data, thoroughly check all applications and files to ensure they are accessible and functioning correctly on the new virtual disk.
- Clean Up the RDM (Optional): Once you are absolutely certain that all necessary data has been migrated and the new virtual disk is working perfectly, you can then proceed to unmap or delete the RDM from your SAN storage if it's no longer needed. This step is performed at the storage array level and is outside the scope of VMware management. Consult your storage vendor's documentation for this process.
Important Notes:
Cloning RDMs: You cannot directly clone an RDM disk using standard VMware cloning methods. You must convert it to a VMDK first.
Conversion to VMDK: A more involved but often safer method is to convert the RDM to a VMDK before removing it. This can be done using:
- vCenter Converter: A free tool from VMware that can convert physical machines or existing VMware machines (including those with RDMs) to new VMs or upgrade existing ones.
- `vmkfstools` command-line utility: On ESXi, you can use `vmkfstools -i /vmfs/volumes/
/ / /vmfs/volumes/ / / ` to create a VMDK from an RDM.
After conversion, you would then detach the original RDM and attach the newly created VMDK.
Frequently Asked Questions (FAQ)
Q: How do I know if my VM is using an RDM?
A: You can determine if your VM is using an RDM by checking the VM's hardware settings in your VMware management interface (like vSphere Client or VMware Workstation). RDMs will be listed as "Raw Device Mapping" or similar, and they will point directly to a LUN on your storage array rather than being a file within a datastore.
Q: What happens to the data on the RDM when I remove it?
A: When you choose to "Remove from virtual machine" in VMware, the RDM is detached from the VM. The data on the underlying physical storage (the LUN) remains untouched. However, the VM will no longer have access to it. If you need to keep that data, you must migrate it to a new virtual disk before or after detaching the RDM.
Q: Can I directly convert an RDM to a VMDK without removing it first?
A: Yes, this is often the recommended approach for safety. You can use tools like VMware vCenter Converter or the `vmkfstools` command-line utility to create a new VMDK file that is a copy of the data on your RDM. Once the VMDK is created, you can then attach it to the VM, migrate the data, and finally remove the RDM.
Q: Why is it so important to back up my VM before removing an RDM?
A: Removing storage devices from a running or even a powered-off VM carries inherent risks. A backup serves as your critical safety net. If any step in the removal or data migration process is performed incorrectly, or if an unexpected issue arises, you can restore your VM and its data from the backup, preventing significant data loss and downtime.

