Help! I somehow deleted Windows files that I need

Technical issues/questions of an intermediate or advanced nature.
User avatar
Ed_P
Contributor
Contributor
Posts: 8374
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Help! I somehow deleted Windows files that I need

Post#1 by Ed_P » 19 Sep 2023, 22:52

I ran a script to remove (rm -rf /NEW;) several files & folders on the /tmp drive that somehow deleted all the files on my Data drive, my Backup drive and some on my Windows drive!! (all NTFS format) Now I can't boot it. I tried Windows' Restore and Recovery apps but they failed. :( Is there a Linux app for restoring deleted files? I can boot my Porteus USB drive on the notebook.

Added in 44 minutes 14 seconds:
Ok, I found in my Optional folder 2 testdisk modules.

Code: Select all

guest@porteus:/mnt/sda1/Optional$ ls -o test*.xzm
-rwxrwxrwx 1 guest  516096 Nov 25  2020 testdisk-7.1-x86_64-1_SBo.xzm*
-rwxrwxrwx 1 guest 5976064 Dec  9  2020 testdisk-7.2-WIP-x86_64-rava.xzm*
guest@porteus:/mnt/sda1/Optional$ 
The top one failed to run. Missing something. The bottom one runs but doesn't see my SSD hardrive. :shock:

Added in 16 minutes 50 seconds:
Found this one: https://filehorst.de/downloadQueue.php? ... irRmVp5CgK for TestDisk & PhotoRec 7.1 and will try it later.

Code: Select all

guest@porteus:/mnt/sda1/Optional$ ls -o test*.xzm
-rwxrwxrwx 1 guest  516096 Nov 25  2020 testdisk-7.1-x86_64-1_SBo.xzm*
-rwxrwxrwx 1 guest 3235840 Sep 19 19:49 testdisk-7.1-x86_64-don.xzm*
-rwxrwxrwx 1 guest 5976064 Dec  9  2020 testdisk-7.2-WIP-x86_64-rava.xzm*
guest@porteus:/mnt/sda1/Optional$ 
Ed

User avatar
Rava
Contributor
Contributor
Posts: 5416
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

Help! I somehow deleted Windows files that I need

Post#2 by Rava » 20 Sep 2023, 01:13

TestDisk & PhotoRec 7.2 WIP

Indeed, back in the days my module testdisk-7.2-WIP-x86_64-rava.xzm was the newest available. Could be that by now there is a newer one out or that testdisk-7.2-WIP is no longer WIP but became testdisk-7.2-x86_64 :)

Added in 1 minute 18 seconds:
Please read my above post since I gave some tips on how to handle data recovery.
Cheers!
Yours Rava

User avatar
Ed_P
Contributor
Contributor
Posts: 8374
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Help! I somehow deleted Windows files that I need

Post#3 by Ed_P » 20 Sep 2023, 04:05

No luck with the -don version. Same as the _SBo version.

Code: Select all

guest@porteus:~$ testdisk
testdisk: error while loading shared libraries: libntfs-3g.so.88: cannot open shared object file: No such file or directory
guest@porteus:~$ 
Added in 12 minutes 34 seconds:
And no luck finding libntfs after running a getmod -u.

Code: Select all

guest@porteus:~$ getmod -s libntfs*
Enter root's password
Password: 

guest@porteus:~$ getmod -s libntfs-3g.so.88
Enter root's password
Password: 

guest@porteus:~$ getmod -s libntfs-3g.so
Enter root's password
Password: 

guest@porteus:~$ 
 
:hammer:
Ed

User avatar
ncmprhnsbl
DEV Team
DEV Team
Posts: 3941
Joined: 20 Mar 2012, 03:42
Distribution: v5.0-64bit
Location: australia
Contact:

Help! I somehow deleted Windows files that I need

Post#4 by ncmprhnsbl » 20 Sep 2023, 07:34

Ed_P wrote:
20 Sep 2023, 04:17
And no luck finding libntfs after running a getmod -u.
it's called ntfs-3g and you already have it, just a newer version(*.so.89) Ravas build of testdisk 7.2 would have been ok for way back then (2020) ..that's like RC1 days..
if you get testdisk 7.0 or 7.1 : https://slackware.nl/slakfinder/index.p ... e=#results they should work.

needless to say, be very careful with rm -rf , especially if used in script run blindly ie. not in terminal, and even then rm -rIv would be much safer, even if annoying.
but that horse is now in another paddock.
Forum Rules : https://forum.porteus.org/viewtopic.php?f=35&t=44

User avatar
Rava
Contributor
Contributor
Posts: 5416
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

Help! I somehow deleted Windows files that I need

Post#5 by Rava » 20 Sep 2023, 08:18

ncmprhnsbl wrote:
20 Sep 2023, 07:34
Ravas build of testdisk 7.2 would have been ok for way back then (2020) ..that's like RC1 days..
It is indeed from the rc1 days of old but the very same build still works flawlessly out of the box for my 5.0 XFCE Porteus. (see below)

@Ed_P: What's with the testdisk-7.2-WIP-x86_64-rava.xzm version?
It is the newest you have? Does that also have missing dependencies?

On my system

Code: Select all

root@rava:/# cat /etc/porteus/*
001-core.xzm:20221211
002-xorg.xzm:20221211
002-xtra.xzm:20221211
003-xfce.xzm:20220925
initrd.xz:20220928
my testdisk-7.2-WIP-x86_64-rava.xzm works out of the box. Activated it (my local version of course has the same md5sum as the one hosted on filehort - since I was the uploader back in "09.12.2020 11:35 Uhr" (local German time according to filehorst; we write ours dates DD.MM.YYYY so that's the 9th of Dec not the 12th of Sep.)

Lookie here for details:

activating:

Code: Select all

root@rava:/# activate /Porteus_modules/testdisk-7.2-WIP-x86_64-rava.xzm
Updating shared library links:  /sbin/ldconfig
testrun:

Code: Select all

root@rava:/# testdisk --help
TestDisk 7.2-WIP, Data Recovery Utility, Novembre 2020
Christophe GRENIER <grenier@cgsecurity.org>
https://www.cgsecurity.org

Usage: testdisk [/log] [/debug] [file.dd|file.e01|device]
       testdisk /list  [/log]   [file.dd|file.e01|device]
       testdisk /version

/log          : create a testdisk.log file
/debug        : add debug information
/list         : display current partitions

TestDisk checks and recovers lost partitions
It works with :
- BeFS (BeOS)                           - BSD disklabel (Free/Open/Net BSD)
- CramFS, Compressed File System        - DOS/Windows FAT12, FAT16 and FAT32
- XBox FATX                             - Windows exFAT
- HFS, HFS+, Hierarchical File System   - JFS, IBM's Journaled File System
- Linux btrfs                           - Linux ext2, ext3 and ext4
- Linux GFS2                            - Linux LUKS
- Linux Raid                            - Linux Swap
- LVM, LVM2, Logical Volume Manager     - Netware NSS
- Windows NTFS                          - ReiserFS 3.5, 3.6 and 4
- Sun Solaris i386 disklabel            - UFS and UFS2 (Sun/BSD/...)
- XFS, SGI's Journaled File System      - Wii WBFS
- Sun ZFS
root@rava:/# echo $?
0
root@rava:/# 
In case you realize you could not use the same folder as me - /Porteus_modules/ is a symlink pointing to my main folder with my extra modules since sda1 is only 1.5GB large and could not hold all my modules:

Code: Select all

root@rava:/# du -scm /Porteus_modules/
5147	/Porteus_modules/
5147	total
I just do not manage to put an extra of 5.03 GB of files onto a drive that has currently only 105 MB free.

Added in 3 hours 27 minutes 34 seconds:
@all

There is a newer version I just downloaded - also called 7.2 WIP, but with this tag when you start it

Code: Select all

TestDisk 7.2-WIP, Data Recovery Utility, August 2023
instead of my older version being:

Code: Select all

TestDisk 7.2-WIP, Data Recovery Utility, Novembre 2020
I will make a new module. Since the new version has some unresolved issue please see this thread for details:
TestDisk & PhotoRec 7.2 WIP 2023.08

beny
Full of knowledge
Full of knowledge
Posts: 2098
Joined: 02 Jan 2011, 11:33
Location: italy

Help! I somehow deleted Windows files that I need

Post#6 by beny » 20 Sep 2023, 15:40

Hi Ed_P you have done something that all the Linux user know as..ok i have to erase all the data that i have, you have to have an empty hard disk and you can save data rescued on It,i have seen also in current Is the 7.1 so you can use without trouble, good luck...

User avatar
Ed_P
Contributor
Contributor
Posts: 8374
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Help! I somehow deleted Windows files that I need

Post#7 by Ed_P » 20 Sep 2023, 15:50

Rava wrote:
20 Sep 2023, 11:45
@Ed_P: What's with the testdisk-7.2-WIP-x86_64-rava.xzm version?

Code: Select all

guest@porteus:~$ testdisk --help
TestDisk 7.2-WIP, Data Recovery Utility, Novembre 2020
Christophe GRENIER <grenier@cgsecurity.org>
https://www.cgsecurity.org

Code: Select all

~#  uname -a
Linux porteus.example.net 6.4.11-porteus #1 SMP PREEMPT_DYNAMIC Sat Aug 19 10:54:06 MSK 2023 x86_64 Intel(R) Core(TM) i3-6100U CPU @ 2.30GHz GenuineIntel GNU/Linux

~#  cat /etc/porteus/*
001-core.xzm:20230617
002-xorg.xzm:20230617
002-xtra.xzm:20221211
003-cinnamon.xzm:20220925
initrd.xz:20220928
Ed

User avatar
Rava
Contributor
Contributor
Posts: 5416
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

Help! I somehow deleted Windows files that I need

Post#8 by Rava » 20 Sep 2023, 16:04

^
Good, then my version works.

Still I recommend using the most recent version, the one from 2023-08.

Until the issue I wrote in the thread linked below is solved I will not release it as a module but you can download the tar.bz2 yourself and extract the stand-alone binary as a work around.
https://www.cgsecurity.org/testdisk-7.2 ... 64.tar.bz2 <- currently that's the TestDisk & PhotoRec 7.2 WIP 2023.08 version.

When you want to discuss the issue with TestDisk & PhotoRec 7.2 WIP 2023.08 we should do so in its own thread.

Added in 3 minutes 30 seconds:
And quite important:
Read every info testdisk gives you calmly and take your time. You do not want to cause any more data losses:
Rava wrote:
09 Dec 2020, 10:39
Be aware that the programs can help with fixing partition issues and data recovery, but applying one or all programs erroneously can also create data loss. =@
Cheers!
Yours Rava

User avatar
Ed_P
Contributor
Contributor
Posts: 8374
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Help! I somehow deleted Windows files that I need

Post#9 by Ed_P » 20 Sep 2023, 19:53

Code: Select all

TestDisk 7.2-WIP, Data Recovery Utility, Novembre 2020
Christophe GRENIER <grenier@cgsecurity.org>
https://www.cgsecurity.org

  TestDisk is free software, and
comes with ABSOLUTELY NO WARRANTY.

Select a media (use Arrow keys, then press Enter):
>Disk /dev/sda - 31 GB / 28 GiB - Verbatim STORE N GO









>[Proceed ]  [  Quit  ]

Note: Some disks won't appear unless you are root user.
Disk capacity must be correctly detected for a successful recovery.
If a disk listed above has an incorrect size, check HD jumper settings and BIOS
detection, and install the latest OS patches and disk drivers.
sda is my USB drive.
This is my harddrive.
Image
/dev/nvme0n1p3 is my Windows drive. Windows OS files and folders.
/dev/nvme0n1p7 is my Data drive. ISOs, Porteus files, pictures, utilities, grub2 cfg menus, etc.
/dev/nvme0n1p8 is my Backups drive. Where I write my Windows Backup files.

How do I get testdrive to see my SSD harddrive?

Added in 7 minutes 5 seconds:
:o In reading the Note's green text in the code I posted above I tried using testdisk as a root user.

Code: Select all

TestDisk 7.2-WIP, Data Recovery Utility, Novembre 2020
Christophe GRENIER <grenier@cgsecurity.org>
https://www.cgsecurity.org

  TestDisk is free software, and
comes with ABSOLUTELY NO WARRANTY.

Select a media (use Arrow keys, then press Enter):
>Disk /dev/sda - 31 GB / 28 GiB - Verbatim STORE N GO
 Disk /dev/loop0 - 109 MB / 103 MiB
 Disk /dev/loop1 - 127 MB / 121 MiB
 Disk /dev/loop10 - 66 MB / 63 MiB
 Disk /dev/loop11 - 27 MB / 25 MiB
 Disk /dev/loop12 - 5976 KB / 5836 KiB (RO)
 Disk /dev/loop2 - 117 MB / 111 MiB
 Disk /dev/loop3 - 18 MB / 17 MiB
 Disk /dev/loop4 - 25 MB / 24 MiB
 Disk /dev/loop5 - 749 KB / 732 KiB
>[Previous]  [  Next  ]  [Proceed ]  [  Quit  ]

Note: Disk capacity must be correctly detected for a successful recovery.
If a disk listed above has an incorrect size, check HD jumper settings and BIOS
detection, and install the latest OS patches and disk drivers.
Added in 2 minutes 39 seconds:
Now to equate /dev/loops to my drive letters.
Ed

donald
Full of knowledge
Full of knowledge
Posts: 2073
Joined: 17 Jun 2013, 13:17
Distribution: Porteus 3.2.2 XFCE 32bit
Location: Germany

Help! I somehow deleted Windows files that I need

Post#10 by donald » 20 Sep 2023, 21:31

Ed_P wrote:
20 Sep 2023, 20:03
How do I get testdrive to see my SSD harddrive?
Try the device name as parameter, something like testdisk /dev/nvme0

User avatar
Rava
Contributor
Contributor
Posts: 5416
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

Help! I somehow deleted Windows files that I need

Post#11 by Rava » 20 Sep 2023, 22:40

Ed_P wrote:
20 Sep 2023, 20:03
I tried using testdisk as a root user.
You need to be root user.
Also you need a partition other than the one you want to recover from that has at least as much free available space as does the partition you want recover. testdisc will ask for that later.
Also, I recommend you use the newest WIP version

Code: Select all

TestDisk 7.2-WIP, Data Recovery Utility, August 2023
from https://www.cgsecurity.org/testdisk-7.2 ... 64.tar.bz2
Read my post TestDisk & PhotoRec 7.2 WIP 2023.08 about the one issue on that version, but that has nothing to do with recovering data.

As soon as the question about the

Code: Select all

linux: Compiled terminfo entry "linux"
is resolved I will create the module.
Post any questions on testdisk 7.2 WIP 2023.08 in that thread.

Added in 17 minutes 51 seconds:
Also @all who are planing on using testdisk to recover data.
Visit the support forum https://forum.cgsecurity.org/phpBB3/ (Forums are in English, German and French)

For the English only stuff go here: https://forum.cgsecurity.org/phpBB3/viewforum.php?f=2
and read what info is to be found about your issue even when testdisk seems to initially do all you want it to do since
Rava wrote:
09 Dec 2020, 10:39
Be aware that the programs can help with fixing partition issues and data recovery, but applying one or all programs erroneously can also create data loss. =@
Cheers!
Yours Rava

User avatar
Ed_P
Contributor
Contributor
Posts: 8374
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Help! I somehow deleted Windows files that I need

Post#12 by Ed_P » 20 Sep 2023, 23:05

Rava wrote:
20 Sep 2023, 22:40
You need to be root user.
So I've learned.
Rava wrote:
20 Sep 2023, 22:40
Also you need a partition other than the one you want to recover from that has at least as much free available space as does the partition you want recover. testdisc will ask for that later.
So testdisc doesn't repair the broken drive, it copies the files on it to another drive. :o Not what I was expecting.
donald wrote:
20 Sep 2023, 21:31
Try the device name as parameter, something like testdisk /dev/nvme0
testdisk /dev/nvme0n1p8 worked. testdisk /dev/nvme0 did not.

Code: Select all

oot@porteus:/home/guest# testdisk /dev/nvme0
TestDisk 7.2-WIP, Data Recovery Utility, Novembre 2020
Christophe GRENIER <grenier@cgsecurity.org>
https://www.cgsecurity.org

Unable to open file or device /dev/nvme0: Inappropriate ioctl for device
root@porteus:/home/guest# 
And testdisk /dev/nvme0n1 worked.

Code: Select all

TestDisk 7.2-WIP, Data Recovery Utility, Novembre 2020
Christophe GRENIER <grenier@cgsecurity.org>
https://www.cgsecurity.org

  TestDisk is free software, and
comes with ABSOLUTELY NO WARRANTY.

Select a media (use Arrow keys, then press Enter):
>Disk /dev/nvme0n1 - 1000 GB / 931 GiB









>[Proceed ]  [  Quit  ]

Note: Disk capacity must be correctly detected for a successful recovery.
If a disk listed above has an incorrect size, check HD jumper settings and BIOS
detection, and install the latest OS patches and disk drivers.
Ed

User avatar
Rava
Contributor
Contributor
Posts: 5416
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

Help! I somehow deleted Windows files that I need

Post#13 by Rava » 20 Sep 2023, 23:18

Ed_P wrote:
20 Sep 2023, 23:05
So testdisc doesn't repair the broken drive, it copies the files on it to another drive. :o Not what I was expecting.
Yes, and it is what it is. From the free tools out there (as in beer) it is one of the best available. You can look for alternatives but when I had my broken partition (Windoze C: partition) found nothing better for data recovery than testdisk.

Also made a screenshot of the forum for you:
Image

And I still strongly recommend you use the newest version available, the testdisk 7.2 WIP 2023.08 one.

In my case, I used

Code: Select all

TestDisk 7.2-WIP, Data Recovery Utility, Novembre 2020
instead of TestDisk 7.1 since back then it was the most recent version available.
But now

Code: Select all

TestDisk 7.2-WIP, Data Recovery Utility, August 2023
is the most recent version.
Cheers!
Yours Rava

beny
Full of knowledge
Full of knowledge
Posts: 2098
Joined: 02 Jan 2011, 11:33
Location: italy

Help! I somehow deleted Windows files that I need

Post#14 by beny » 20 Sep 2023, 23:51

Hi Ed_P try a fsck on One unknown partition try it with gparted,and don't change anything

donald
Full of knowledge
Full of knowledge
Posts: 2073
Joined: 17 Jun 2013, 13:17
Distribution: Porteus 3.2.2 XFCE 32bit
Location: Germany

Help! I somehow deleted Windows files that I need

Post#15 by donald » 21 Sep 2023, 00:13

@Ed
The screenshot (Gparted) looks almost identical to this one [File System unknown]:
...same procedure as last year -- ntfsfix
GParted missing gpart

Post Reply