Migrate a File Server with RDM While Retaining Share Permissions

When setting up a brand-new file server, it’s crucial to ensure that all share permissions, CNAME registrations, dynamic DNS settings, and security permissions are copied before removing and moving an RDM (Raw Device Mapping) LUN. This guide details the steps using virt-file-01 (Windows Server 2016 with RDM) as the source and virt-file-02 (Windows Server 2019) as the destination.


Step 1: Export Share Permissions from virt-file-01

Method 1: Using PowerShell

$SourceShare = "YourShareName" # Replace with actual share name
$ShareInfo = Get-SmbShare -Name $SourceShare | Select-Object -Property Name, Path, Description
$SharePermissions = Get-SmbShareAccess -Name $SourceShare
$ShareInfo | Export-Clixml "C:\Temp\ShareInfo.xml"
$SharePermissions | Export-Clixml "C:\Temp\SharePermissions.xml"

Method 2: Using Registry Export

  1. Open Regedit and navigate to: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Shares
  2. Right-click the Shares key and select Export.
  3. Save the file as C:\Temp\Shares.reg.

Step 2: Backup NTFS Permissions

icacls D:\ /save C:\Temp\NTFSPermissions.txt /t /c

Step 3: Export DNS and CNAME Settings

Using Command Line

nslookup virt-file-01

To list and document CNAME records:

dnscmd /enumrecords domain.com fileserver

Backup dynamic DNS settings:

dnscmd /zoneexport domain.com C:\Temp\dnsbackup.txt

Using GUI

  1. Open DNS Manager (dnsmgmt.msc).
  2. Navigate to Forward Lookup Zones > YourDomain.com.
  3. Locate and document A/CNAME records for virt-file-01.
  4. Right-click on the zone, choose Export List, and save it.

Step 4: Remove the RDM LUN from virt-file-01

  1. Ensure all sessions are disconnected.
  2. Offline the disk in Disk Management.
  3. Remove the RDM mapping from the VM configuration.

Step 5: Attach the RDM LUN to virt-file-02

  1. Attach the LUN to the new VM as an RDM.
  2. Bring the disk online and ensure the same drive letter is assigned.
  3. Verify data integrity.

Step 6: Import Share Permissions to virt-file-02

Method 1: Using PowerShell

$NewShare = "YourShareName" # Replace with actual share name
$ShareInfo = Import-Clixml "C:\Temp\ShareInfo.xml"
$SharePermissions = Import-Clixml "C:\Temp\SharePermissions.xml"

New-SmbShare -Name $NewShare -Path $ShareInfo.Path -FullAccess Everyone # Modify permissions as needed

foreach ($perm in $SharePermissions) {
    Grant-SmbShareAccess -Name $NewShare -AccountName $perm.AccountName -AccessRight $perm.AccessRight -Force
}

Method 2: Using Registry Import

  1. Copy C:\Temp\Shares.reg to virt-file-02.
  2. Double-click the file to import it into the registry.
  3. Restart the Server service: net stop lanmanserver && net start lanmanserver

Step 7: Restore NTFS Permissions

icacls D:\ /restore C:\Temp\NTFSPermissions.txt

Step 8: Reconfigure DNS and CNAME on virt-file-02

Using Command Line

dnscmd /recordadd domain.com virt-file-02 A <New-IP>
dnscmd /recordadd domain.com fileserver CNAME virt-file-02.domain.com

Force dynamic DNS update:

ipconfig /registerdns

Using GUI

  1. Open DNS Manager (dnsmgmt.msc).
  2. Navigate to Forward Lookup Zones > YourDomain.com.
  3. Right-click and choose New Host (A or AAAA) to update the IP address.
  4. Create a new CNAME record pointing to virt-file-02.domain.com.

Final Verification

  1. Test file access from a client machine.
  2. Verify permissions and accessibility.
  3. Ensure DNS and CNAME records resolve correctly.
  4. Confirm all shares function as expected on virt-file-02.
  5. Check Event Viewer logs for any permission-related issues.

By following this process, all share settings, security permissions, and DNS configurations are migrated smoothly, allowing a seamless transition to the new server.


Need more advanced storage or VMware-related tips? Check out vmanalyst.com for in-depth guides!

(Visited 10 times, 1 visits today)

By Ash Thomas

Ash Thomas is a seasoned IT professional with extensive experience as a technical expert, complemented by a keen interest in blockchain technology.

Leave a Reply