Windows Subsystem for Linux (WSL) is a compatibility layer that allows users to run Linux commands and applications directly on Windows 10. It provides a convenient way to work with Linux tools without the need for a separate virtual machine or dual-boot setup. However, if you accidentally delete or lose important files within the WSL environment, don't worry! In this guide, we will show you how to recover WSL files using a Linux Live USB.
What is a Linux Live USB?
A Linux Live USB is a portable operating system that can be booted directly from a USB drive without installation. It allows you to run Linux on any computer without modifying the existing operating system. This feature is particularly useful for data recovery purposes, as it enables you to access and recover files from a damaged or non-bootable system.
Step 1: Create a Linux Live USB
The first step is to create a Linux Live USB. You will need a USB drive with at least 4GB of storage capacity. Follow these steps to create a Linux Live USB:
- Download a Linux distribution ISO file, such as Ubuntu or Fedora, from the official website.
- Insert the USB drive into your computer.
- Download and install a USB bootable software, such as Rufus or Etcher.
- Open the USB bootable software and select the Linux ISO file you downloaded.
- Select the USB drive as the destination device.
- Click on the "Start" or "Create" button to begin the process.
- Wait for the software to create the Linux Live USB.
Step 2: Boot from the Linux Live USB
Once you have created the Linux Live USB, you need to boot your computer from it. Follow these steps to boot from the Linux Live USB:
- Insert the Linux Live USB into the computer from which you want to recover WSL files.
- Restart the computer.
- During the boot process, press the appropriate key (usually F12, F10, or Esc) to access the boot menu.
- Select the USB drive from the boot menu and press Enter.
- The computer will now boot into the Linux Live USB environment.
Step 3: Mount the WSL Drive
Once you have booted into the Linux Live USB environment, you need to mount the WSL drive to access its files. Follow these steps to mount the WSL drive:
- Open a terminal or command prompt in the Linux Live USB environment.
- Type the following command to list the available drives:
lsblk - Identify the WSL drive based on its size and partition layout. It is typically labeled as
/dev/sdX, where X is a letter representing the drive. - Type the following command to mount the WSL drive:
sudo mount /dev/sdX /mnt
Step 4: Recover WSL Files
Now that you have mounted the WSL drive, you can recover your lost or deleted files. Follow these steps to recover WSL files:
- Navigate to the mounted WSL drive using the file manager or terminal.
- Locate the directory where your files were stored within the WSL environment.
- Copy the desired files to a separate location, such as an external USB drive or another storage device.
Congratulations! You have successfully recovered your WSL files using a Linux Live USB. Remember to safely remove the USB drive and restart your computer to boot back into the normal operating system.
Conclusion
Accidentally deleting or losing files within the Windows Subsystem for Linux (WSL) environment can be frustrating. However, with the help of a Linux Live USB, you can easily recover your important files. By following the steps outlined in this guide, you can mount the WSL drive and retrieve your files using a Linux Live USB. Remember to always create backups of your important data to avoid such situations in the future.
References
| Number | Source |
|---|---|
| 1 | Windows Subsystem for Linux (WSL) Documentation |
| 2 | Ubuntu - Create a USB stick on Windows |
| 3 | Rufus - Create bootable USB drives |
| 4 | Etcher - Flash OS images to SD cards & USB drives |