Do you often find it frustrating to frequently switch between Windows and Linux systems to transfer or share files across different operating systems, which not only delays work efficiency but also prone to errors?

Is there a way to operate files in a Linux system as if you were accessing a local hard drive within the Windows system? I hope the practical operations shared in this article can help friends in need.

 

Prerequisites

The operation must be performed on a Windows 10 version 2004 or higher (Build 19041 or higher) or Windows 11 system.

 

Step One: Install WSL on Windows

1、Open PowerShell or the Windows Command Prompt in Administrator mode:

Press the Win + X key combination to open the Quick Access menu.

In the menu, select "Windows PowerShell (Administrator)" to run PowerShell as an administrator.

2、Enter the wsl --install command.

After the completion, restart your computer.

3、After the computer restarts, you will need to create a user account and password for the newly installed Linux subsystem.

Note: The Windows Subsystem for Linux (WSL) is a feature of Windows that allows you to run a Linux environment on your Windows computer without the need for a separate virtual machine or dual boot. WSL is designed to provide a seamless and efficient experience for developers who wish to use both Windows and Linux.

 

Step Two: Mount the Disk in WSL 2

Obtain the list of drives

  • Open PowerShell or the Windows Command Prompt in Administrator mode;
  • Run the command wmic diskdrive list brief to get the list of available drives.

Command Explanation:

wmic diskdrive list brief is a Windows Management Instrumentation Command-line (WMIC) command used to list all the disk drives in the system. WMIC is a command-line tool in the Windows operating system used for managing the system.

  • Caption: A brief description of the disk drive, usually similar to the Model, but may contain more user-friendly information.
  • DeviceID: The device identifier for the disk drive.
  • Model: The model of the disk drive.
  • Partitions: The number of partitions on the disk drive.
  • Size: The size of the disk drive, in bytes.

 

WSL Mounting

In our example, our external hard drive is PHYSICALDRIVE1, you can use the command to mount it:

wsl --mount \\.\PHYSICALDRIVE1 --partition 1

Command Explanation:

  • WSL: This is the command-line tool for launching the Windows Subsystem for Linux.
  • --mount: This option is used to mount a physical disk or its partition into WSL.
  • .\PHYSICALDRIVE1: This is the specified physical drive. In Windows, physical drives are usually identified as \.\PHYSICALDRIVE0, \.\PHYSICALDRIVE1, and so on, where this refers to the second physical drive.
  • --partition 1: This is the partition number that is specified to be mounted.

To mount a specified file system, you can use the following command:  wsl --mount \\.\PHYSICALDRIVE1 --partition 1 -t ext3

 

Graphical Access to Mounted Hard Drive

To access the mounted disk, please open the Windows File Explorer, then go to the Linux category and navigate to /mnt/wsl.

 

Unmount the Disk

You can use the command to unmount the disk:  wsl --unmount \\.\PHYSICALDRIVE1

 

Summary

For users who frequently need to switch between Windows and Linux systems, mounting a Linux disk in Windows is a practical operation that facilitates file sharing and operations between different operating systems. Friends who are interested, come and give it a try!

Finally, special thanks to the deepin (Deep OS) forum user Dongyi Langzi for creating this tutorial. We also welcome all users to contribute actively. We will regularly select and showcase quality content to promote this technical marketplace together, making it prosperous and thriving.

 

Appendix:

(1) deepin V23 RC ISO : https://www.deepin.org/en/download/

(2)deepin Previous Versions(include deepin V15): https://distrowatch.com/table.php?distribution=deepin

 

 

Content source: deepin community
Reprinted with attribution

Leave a Reply