ext4.vhdx (WSL virtual disk)rm -rf /home/dwkim_nethru/log
log/
└── etl/
└── task/
├── script1.sh
├── script2.sh
└── script3.sh
Restore the deleted log directory with its original structure.
log directory recovery faileddata, install, and app were recovered successfullyWSL2 does not run on a physical Linux disk.
Instead, it stores the Linux filesystem inside a virtual disk file.
Windows
└── WSL2
└── ext4.vhdx
└── ext4 filesystem
└── /home/dwkim_nethru
Typical location of the virtual disk:
C:\Users\<user>\AppData\Local\Packages\...\ext4.vhdx
This file contains the full Linux filesystem used by WSL.
That means file deletion happens inside the actual ext4 filesystem stored in the VHDX file.
rm -rf Works in ext4From an ext4 filesystem perspective, deletion usually follows these steps:
Important point:
This is why recovering the original directory structure is much harder than recovering raw file content.
Because extundelete requires an unmounted filesystem, the initial recovery idea was:
WSL
└── ext4.vhdx
└── attach to Ubuntu VM
└── mount read-only
The goal was to recover the ext4 filesystem in a safer and more standard Linux recovery environment.
WSL disks use a dynamic VHDX format.
When attached to a VM, this may introduce block mapping or device recognition issues.
Typical Linux disks often look like this:
MBR/GPT
└── partition
└── filesystem
WSL disks are often closer to this:
ext4 filesystem directly inside VHDX
This can confuse recovery tools that expect a normal partition layout.
Recovery success is highest immediately after deletion.
In this case, several mount and scan operations happened before recovery was completed.
During that process, ext4 journal cleanup likely removed inode metadata.
The most practical access path was:
wsl --mount ext4_backup.vhdx
This allowed the disk to be mounted directly inside WSL.
WSL kernel
└── ext4 mount
└── /mnt/recover
In practice, this worked more reliably than the VM-based approach for a WSL disk.
The recovery tools behaved as follows:
extundelete → faileddebugfs lsdel → no deleted inode foundphotorec → partial raw file recovery possibleInterpretation:
The following directories were recovered successfully:
/home/dwkim_nethru/data
/home/dwkim_nethru/install
/home/dwkim_nethru/app
Reason:
These directories were not deleted.
They were simply copied after mounting the filesystem.
rm -rf removes directory metadata immediatelyDirectory reconstruction becomes very difficult once metadata is gone.
extundelete is time-sensitiveIt works best only when:
For this case, wsl --mount was more reliable than attaching the disk to a VM.
After accidental deletion, the most important step is:
stop further write activity immediately
Use scheduled archive backups such as:
cron + tar backup
wsl --export Ubuntu ubuntu_backup.tar
ETL scripts should always be stored in a Git repository.
In WSL ext4 filesystems, once journal metadata is cleaned up after an rm -rf deletion, directory structure recovery becomes nearly impossible.
The real lesson from this case is simple:
recovery is difficult, prevention is cheaper
Reliable engineering starts with backup and version control, not recovery tooling.