In Arch Linux, many tools are available for data recovery — both command-line and GUI-based. Below are the most commonly used tools, installation methods, and practical examples.
TestDiskTestDisk is a powerful CLI tool for recovering lost partitions and repairing a damaged MBR or GPT.
sudo pacman -S testdisk
sudo testdisk
TestDisk will guide you through an interactive (text-based) recovery process. Possible actions:
PhotoRecPhotoRec is a tool for recovering files from storage media — even with a damaged file system.
It’s part of the testdisk package, no separate installation needed.
sudo photorec
PhotoRec ignores the file system and attempts to recover data from raw sectors.
extundeleteextundelete allows you to recover deleted files from ext3/ext4 partitions.
yay -S extundelete
(Available in AUR — requires yay or another helper)
sudo umount /dev/sdX1
sudo extundelete /dev/sdX1 --restore-all
Recovered files will be saved in the RECOVERED_FILES/ directory.
ddrescueGNU ddrescue allows you to make a binary copy of a disk, even if it has damaged sectors.
sudo pacman -S gnu-ddrescue
sudo ddrescue /dev/sdX /mnt/backup/image.img /mnt/backup/logfile.log
You can later mount the image and try to recover the data:
sudo mount -o loop image.img /mnt/recovery
scalpelScalpel is a data recovery tool based on file header patterns and signatures.
yay -S scalpel
First, edit /etc/scalpel/scalpel.conf and enable the file types you want to recover (e.g., JPG, PDF).
sudo scalpel /dev/sdX -o /mnt/recovery/scalpel_out
rmlint (for detecting/removing duplicates and broken files)rmlint is not a direct recovery tool but helps with disk analysis and preparing for recovery.
sudo pacman -S rmlint
rmlint /mnt/recovery_disk -o summary
After creating a disk image (e.g., with ddrescue), you can analyze it using tools like:
mount -o loop — mount imagefsck — check and repair file systemdebugfs — explore ext4/ext3 structuresforemost — recover based on file signaturesBtrfs is a modern file system with snapshot functionality that can make data recovery easier — but in cases of severe corruption, it requires caution and understanding of internal structures.
snapshot (if available)If the system has automatic snapshots (e.g., via Snapper or Timeshift):
sudo btrfs subvolume list /mnt/btrfs
sudo btrfs subvolume show /mnt/btrfs/.snapshots/123/snapshot
sudo cp -a /mnt/btrfs/.snapshots/123/snapshot/home/user/data /home/user/recovered
btrfs restoreThe btrfs restore command allows exporting data from a damaged file system without mounting it.
sudo pacman -S btrfs-progs
sudo btrfs restore -v /dev/sdX1 /mnt/recovery