Zarya external drive repair

Step-by-step guide to scan, identify and delete corrupted files on a failing external drive. All commands are safe dry-runs first — nothing is modified until you confirm.
Before you start: If you can copy any data off this drive, do that first. Repair is a last resort. Keep the drive plugged into a power source — not a laptop battery. Close every app that might be accessing the drive.
step 1
Identify the drive
List all block devices and find your external drive by size. Look for /dev/sdX entries.
lsblk
sudo fdisk -l
step 2
Mount the drive (if needed)
Replace sdb1 with your actual partition from step 1.
sudo mkdir -p /mnt/external
sudo mount /dev/sdb1 /mnt/external
mount | grep external
step 3
Scan and delete corrupted files
This one-liner finds files that file can't read and deletes them, writing a log to ~/deleted_files.txt.
for file in $(find /mnt/external -type f 2>/dev/null); do if ! file "$file" >/dev/null 2>&1; then echo "DELETING: $file" >> ~/deleted_files.txt && rm -f "$file"; fi; done
View what was deleted:
cat ~/deleted_files.txt
Detailed scan: For a progress bar version, copy the script from the Advanced tab.
step 4
Repair filesystem
Unmount first, then run a dry-run check (-n). Only after reviewing the output, run the actual repair (-y). Pick the section for your drive's filesystem.
NTFS (Windows):
sudo apt install ntfs-3g
sudo ntfsck -n /dev/sdb1
sudo ntfsck -P --progress /dev/sdb1
ext4 (Linux):
sudo umount /dev/sdb1
sudo fsck -n /dev/sdb1
sudo fsck -y /dev/sdb1
exFAT:
sudo fsck.exfat -n /dev/sdb1
sudo fsck.exfat -y /dev/sdb1
step 5
Verify and remount
sudo mount /dev/sdb1 /mnt/external
ls -lah /mnt/external
cat ~/deleted_files.txt
step 1
Identify the drive
diskutil list
diskutil info /Volumes/YourDriveName
step 2
Scan and delete corrupted files
Replace YourDriveName with your drive's mount name from step 1.
for file in $(find /Volumes/YourDriveName -type f 2>/dev/null); do if ! cat "$file" >/dev/null 2>&1; then echo "DELETING: $file" >> ~/Desktop/deleted_files.txt && rm -f "$file"; fi; done
cat ~/Desktop/deleted_files.txt
step 3
Repair filesystem
NTFS:
brew install ntfs-3g
diskutil unmount /dev/disk2s1
sudo ntfsck -P --progress /dev/disk2s1
exFAT:
diskutil unmount /dev/disk2s1
sudo fsck_exfat -n /dev/disk2s1
sudo fsck_exfat -y /dev/disk2s1
FAT32:
diskutil unmount /dev/disk2s1
sudo fsck_fat -y /dev/disk2s1
step 4
Remount
diskutil mount /Volumes/YourDriveName
cat ~/Desktop/deleted_files.txt
detailed scan
Progress bar scan script
Save as scan_and_delete.sh, make executable, and run. Shows progress percentage and logs every deletion.
#!/bin/bash
MOUNT_POINT="/mnt/external"
LOG_FILE="$HOME/deleted_files.txt"
DELETED_COUNT=0
TOTAL_FILES=$(find "$MOUNT_POINT" -type f 2>/dev/null | wc -l)
CURRENT=0
> "$LOG_FILE"
echo "Starting scan on $MOUNT_POINT..."
echo "Total files to check: $TOTAL_FILES"
find "$MOUNT_POINT" -type f 2>/dev/null | while read file; do
CURRENT=$((CURRENT + 1))
PERCENT=$((CURRENT * 100 / TOTAL_FILES))
echo -ne "\rProgress: $PERCENT% ($CURRENT/$TOTAL_FILES)"
if ! cat "$file" >/dev/null 2>&1; then
echo ""
echo "CORRUPTED: $file" | tee -a "$LOG_FILE"
rm -f "$file"
echo "✓ Deleted" | tee -a "$LOG_FILE"
fi
done
echo ""
echo "Scan complete. Log: $LOG_FILE"
chmod +x scan_and_delete.sh && ./scan_and_delete.sh
filtered scan
Find corrupted files by type
Scan only for specific file types — useful when you know e.g. video files are the issue.
find /mnt/external -type f \( -name "*.mkv" -o -name "*.mp4" \) | while read f; do if ! file "$f" >/dev/null 2>&1; then echo "Corrupted: $f"; fi; done
recovery
Recover files with TestDisk / PhotoRec
Instead of deleting, try recovering the data first. PhotoRec can salvage files from drives with bad sectors.
Ubuntu:
sudo apt install testdisk && sudo photorec /dev/sdb1
macOS:
brew install testdisk && photorec /dev/disk2s1
health
Check drive health (S.M.A.R.T.)
Check if the drive itself is failing, not just the filesystem. Replace sdb (not sdb1 — S.M.A.R.T. is per-device).
sudo apt install smartmontools && sudo smartctl -a /dev/sdb
brew install smartmontools && smartctl -a /dev/disk2
troubleshoot
Troubleshooting
Drive won't unmount: Find what's using it and force unmount.
lsof | grep /mnt/external
sudo umount -f /dev/sdb1
Find unreadable sectors:
sudo dd if=/dev/sdb1 of=/dev/null bs=4M status=progress