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: 8912
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#16 by Ed_P » 21 Sep 2023, 01:48

Thank you beny and donald. :friends:
Rava wrote:
17 Nov 2022, 16:58
You only need the txz, or not?
So wget'ing https://slakfinder.org/sbomt64-15.0/sys ... 4-2smt.txz should suffice.

Code: Select all

root@porteus:/home/guest# wget https://slakfinder.org/sbomt64-15.0/system/gpart/gpart-0.3-x86_64-2smt.txz
--2023-09-20 21:37:41--  https://slakfinder.org/sbomt64-15.0/system/gpart/gpart-0.3-x86_64-2smt.txz
Resolving slakfinder.org (slakfinder.org)... 87.98.219.121
Connecting to slakfinder.org (slakfinder.org)|87.98.219.121|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2023-09-20 21:37:43 ERROR 404: Not Found
donald wrote:
21 Sep 2023, 00:13
The screenshot (Gparted) looks almost identical to this one
Similar but not identical. The Used column's numbers are much smaller. :(

donald
Full of knowledge
Full of knowledge
Posts: 2104
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#17 by donald » 21 Sep 2023, 02:35

Ed_P wrote:
21 Sep 2023, 01:48
Similar but not identical. The Used column's numbers are much smaller.
Doesn't matter -- the problem is, the partition(s) not recognized as NTFS ones.
Windows' Restore and Recovery apps do not work because of this.
( no Windows installation found )

may be that ntfsfix can flag them being NTFS and you can use whatever Windows
backup/restore tools/disk you have.

User avatar
Ed_P
Contributor
Contributor
Posts: 8912
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#18 by Ed_P » 21 Sep 2023, 04:01

Ok donald a valid point. The problem is I don't have the ntfsfix app, it's on the harddrive but not on my USB drive and Rava's download link doesn't work.

In reviewing that 2022 thread you pointed me to I see I have ntfs-3g.

Code: Select all

root@porteus:/home/guest# ntfs-3g
ntfs-3g: No device is specified.

ntfs-3g 2022.10.3 integrated FUSE 27 - Third Generation NTFS Driver
		Configuration type 1, XATTRS are on, POSIX ACLS are off

Copyright (C) 2005-2007 Yura Pakhuchiy
Copyright (C) 2006-2009 Szabolcs Szakacsits
Copyright (C) 2007-2022 Jean-Pierre Andre
Copyright (C) 2009-2020 Erik Larsson

Usage:    ntfs-3g [-o option[,...]] <device|image_file> <mount_point>

Options:  ro (read-only mount), windows_names, uid=, gid=,
          umask=, fmask=, dmask=, streams_interface=.
          Please see the details in the manual (type: man ntfs-3g).

Example: ntfs-3g /dev/sda1 /mnt/windows

Plugin path: /usr/lib64/ntfs-3g

News, support and information:  https://github.com/tuxera/ntfs-3g/
And as root I have ntfsfix! :o

Code: Select all

root@porteus:/home/guest# ntfsfix
ERROR: You must specify a device.
ntfsfix v2022.10.3 (libntfs-3g)

Usage: ntfsfix [options] device
    Attempt to fix an NTFS partition.

    -b, --clear-bad-sectors Clear the bad sector list
    -d, --clear-dirty       Clear the volume dirty flag
    -h, --help              Display this help
    -n, --no-action         Do not write anything
    -V, --version           Display version information

For example: ntfsfix /dev/hda6

Developers' email address: [email protected]
News, support and information:  https://github.com/tuxera/ntfs-3g/
root@porteus:/home/guest# 
I need to review that 2022 thread more.

donald
Full of knowledge
Full of knowledge
Posts: 2104
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#19 by donald » 21 Sep 2023, 04:14

you once had it:
GParted missing gpart (Post by Ed_P #91512)
where did it go?

User avatar
Rava
Contributor
Contributor
Posts: 5424
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#20 by Rava » 21 Sep 2023, 04:50

@donald: Did you get my PM?

Added in 16 minutes 4 seconds:
Ed_P wrote:
21 Sep 2023, 04:01
And as root I have ntfsfix! :o
Some programs in /sbin, /usr/sbin or /usr/local/sbin are useable for user root only.

But that could be true for any folder that is part of your $PATH

But usually none of these folders are part of guest's $PATH :

Code: Select all

guest@rava:/usr/local/bin$ echo $PATH 
/usr/local/bin:/usr/bin:/bin:/usr/games
but are part of root's $PATH

Code: Select all

root@rava:~# echo $PATH
/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/games
A program can still be executed as guest, e.g. fdisk:

Code: Select all

guest@rava:/usr/local/bin$ fdisk
bash: fdisk: command not found
guest@rava:/usr/local/bin$ /sbin/fdisk 
fdisk: bad usage
Try 'fdisk --help' for more information.
If it is a good idea to execute such programs as anyone but root is a different matter, though. =@

Anyhow, for me ntfsfix works as user guest:

Code: Select all

guest@rava:/usr/local/bin$ ntfsfix
ERROR: You must specify a device.
ntfsfix v2021.8.22 (libntfs-3g)

Usage: ntfsfix [options] device
    Attempt to fix an NTFS partition.

    -b, --clear-bad-sectors Clear the bad sector list
    -d, --clear-dirty       Clear the volume dirty flag
    -h, --help              Display this help
    -n, --no-action         Do not write anything
    -V, --version           Display version information

For example: ntfsfix /dev/hda6

Developers' email address: [email protected]
News, support and information:  http://tuxera.com
Is that something I should be concerned about, security-wise?
Cheers!
Yours Rava

User avatar
Ed_P
Contributor
Contributor
Posts: 8912
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#21 by Ed_P » 21 Sep 2023, 05:18

donald wrote:
21 Sep 2023, 04:14
you once had it:
GParted missing gpart (Post by Ed_P #91512)
where did it go?
Ed_P wrote:
21 Sep 2023, 04:01
it's on the messed up harddrive but not on my USB drive
But now I have gpart.

Code: Select all

root@porteus:/home/guest# getmod -m gpart

Reading Package Lists...Done
The following NEW packages will be installed:
  gpart 
0 upgraded, 0 reinstalled, 1 newly installed, 0 to remove, 0 not upgraded.
Need to get 35.0kB of archives.
Do you want to continue? [y/N] y
1/1 Get http://slackware.uk/salix/x86_64/extra-15.0/ gpart 0.3-x86_64-2salix15.0 [35.0kB]...Done

Done
Verifying package gpart-0.3-x86_64-2salix15.0.txz.
Installing package gpart-0.3-x86_64-2salix15.0.txz:
PACKAGE DESCRIPTION:
# gpart (Guess PC-type hard disk partitions)
#
# A tool which tries to guess the primary partition table of a PC-type
# hard disk in case the primary partition table in sector 0 is damaged,
# incorrect or deleted. The guessed table can be written to a file or
# device.
#
# Homepage: https://github.com/baruch/gpart
#
[code]

User avatar
Rava
Contributor
Contributor
Posts: 5424
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#22 by Rava » 21 Sep 2023, 05:19

^
ahhhh Image good old trusty getmod. <B
Ed_P wrote:
21 Sep 2023, 04:01
it's on the harddrive but not on my USB drive and Rava's download link doesn't work.
Which link do you mean?
Cheers!
Yours Rava

User avatar
Ed_P
Contributor
Contributor
Posts: 8912
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#23 by Ed_P » 21 Sep 2023, 05:23

Rava wrote:
21 Sep 2023, 05:08
Anyhow, for me ntfsfix works as user guest:
It works for me as guest also.

Code: Select all

guest@porteus:~$ ntfsfix
ERROR: You must specify a device.
ntfsfix v2022.10.3 (libntfs-3g)

Usage: ntfsfix [options] device
    Attempt to fix an NTFS partition.
Why I thought it didn't work I have no idea at this point.

Added in 1 minute 56 seconds:
Rava wrote:
21 Sep 2023, 05:19
Which link do you mean?
See my posting here: Help! I somehow deleted Windows files that I need (Post by Ed_P #95815)

Added in 2 minutes 35 seconds:
Rava wrote:
21 Sep 2023, 05:08
@donald: Did you get my PM?
Did you get it donald? Was it useful or funny?

User avatar
Rava
Contributor
Contributor
Posts: 5424
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#24 by Rava » 21 Sep 2023, 10:03

Ed_P wrote:
21 Sep 2023, 05:27
See my posting here: Help! I somehow deleted Windows files that I need (Post by Ed_P #95815)
Oh, from back in Nov of 2022.
Going to https://slakfinder.org/ tells you this
The Slackware Package Finder search engine is temporarily non-functional.
It will be back as soon as possible.

You will be redirected on Alien Bob's modified instance in a few seconds...

Thanks for your patience.
and redirects you to https://slackware.nl/slakfinder/

Next time a link seems non functional start the base URL - keep http://example.com but cut off everything else like http://example.com/bla/blubb/whatever/ and you might figure out by yourself what went wrong when the site did not tell you or only told you 404. Took me less than 5 seconds figuring that out.

And I still recommend you downloading and extracting this:
Rava wrote:
21 Sep 2023, 10:00
Added in 18 hours 24 minutes 31 seconds:
Until the above described issue is resolved for now you can download and extract it out of the tar.bz2 file from here:
https://www.cgsecurity.org/testdisk-7.2 ... 64.tar.bz2
click the ↑ link to go to my post with has much more info.
Cheers!
Yours Rava

User avatar
Ed_P
Contributor
Contributor
Posts: 8912
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#25 by Ed_P » 21 Sep 2023, 20:17

Rava wrote:
21 Sep 2023, 10:03
click the ↑ link to go to my post with has much more info.

Code: Select all

guest@porteus:~/Downloads$ tar2xzm *.tar.bz2
bash: tar2xzm: command not found
guest@porteus:~/Downloads$ su
Password: 
root@porteus:/home/guest/Downloads# tar2xzm *.tar.bz2
bash: tar2xzm: command not found
root@porteus:/home/guest/Downloads# ls -lght *tar*
-rw-r--r-- 1 users 7.1M Sep 21 16:09 testdisk-7.2-WIP.linux26-x86_64.tar.bz2
root@porteus:/home/guest/Downloads# 

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

Help! I somehow deleted Windows files that I need

Post#26 by beny » 21 Sep 2023, 20:44

Hi Ed_P but have porteus this tool?

User avatar
Rava
Contributor
Contributor
Posts: 5424
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#27 by Rava » 21 Sep 2023, 23:52

Ed_P wrote:
21 Sep 2023, 20:17

Code: Select all

root@porteus:/home/guest/Downloads# tar2xzm *.tar.bz2
bash: tar2xzm: command not found
root@porteus:/home/guest/Downloads# ls -lght *tar*
-rw-r--r-- 1 users 7.1M Sep 21 16:09 testdisk-7.2-WIP.linux26-x86_64.tar.bz2
root@porteus:/home/guest/Downloads# 
Indeed there is no tar2xzm. And there will be none since tar balls hardly use a path hierarchy inside that can be used to create a module. You have to create the needed folder hierarchy yourself, e.g. usr/bin or usr/man
You can use tar itself to extract a .tar.bz2 - but you need to know the syntax.
You can use the archive program for your DE.
Or my preferred method: use mc

Create a folder first because sometimes a tar has its files in an appropriate folder, and sometimes it has not; thus to be on the safe side create an appropriate named folder manually : go into /home/guest/Downloads

Code: Select all

guest@porteus:~/Downloads$ su
Password: 
root@porteus:/home/guest/Downloads# mkdir testdisk-7.2-WIP.linux26-x86_64
root@porteus:/home/guest/Downloads# mc . testdisk-7.2-WIP.linux26-x86_64/
Now use the one window of mc that shows you /home/guest/Downloads to open testdisk-7.2-WIP.linux26-x86_64.tar.bz2 - the other shows you the empty just created /home/guest/Downloads/testdisk-7.2-WIP.linux26-x86_64/ because you told mc showing you this in its other window by the way you called mc just now.

Extract all files from the tar archive using the highlighting function of mc and its copy function, copy these files into the empty /home/guest/Downloads/testdisk-7.2-WIP.linux26-x86_64/ folder - keep the original paths for now, you will not create a module out of /home/guest/Downloads/testdisk-7.2-WIP.linux26-x86_64/

Now you have all files extracted into /home/guest/Downloads/testdisk-7.2-WIP.linux26-x86_64/

If you want to make it into a module do a xzm2dir on my testdisk-7.2-WIP-x86_64-rava.xzm (version Novembre 2020) as an template:

Extract my old version

as root, again in /home/guest/Downloads/ :

Code: Select all

mkdir testdisk-WIP-7.2_2023.08-x86_64_Ed_P
xzm2dir /path/to/old/testdisk-7.2-WIP-x86_64-rava.xzm  testdisk-WIP-7.2_2023.08-x86_64_Ed_P/
Now use mc again to overwrite the old files in /home/guest/Downloads/testdisk-WIP-7.2_2023.08-x86_64_Ed_P/ with the new ones from /home/guest/Downloads/testdisk-7.2-WIP.linux26-x86_64/ but keep the folder hierarchy the same as it was for my old module or it would not work. Put the binaries into its folder where the old binaries are, the man pages into the man folder (when such thing existed in the tar.bz2 archive - in our case it does) etcetera.

First test if the binary works as intended.

Move into the appropriate folder in /home/guest/Downloads/testdisk-WIP-7.2_2023.08-x86_64_Ed_P/
Since lsxzm on my Novembre 2020 module of testdisk-7.2 shows me this file hierarchy

Code: Select all

/usr
/usr/bin
/usr/bin/fidentify
/usr/bin/fidentify_static
/usr/bin/photorec
/usr/bin/photorec_static
/usr/bin/testdisk
/usr/bin/testdisk_static
/usr/doc
/usr/doc/testdisk-7.2-WIP
/usr/doc/testdisk-7.2-WIP/AUTHORS
/usr/doc/testdisk-7.2-WIP/ChangeLog
/usr/doc/testdisk-7.2-WIP/NEWS
/usr/doc/testdisk-7.2-WIP/README.md
/usr/doc/testdisk-7.2-WIP/THANKS
/usr/doc/testdisk-7.2-WIP/documentation.html
/usr/man
/usr/man/man8
/usr/man/man8/fidentify.8
/usr/man/man8/photorec.8
/usr/man/man8/testdisk.8
/var
/var/lib
/var/lib/pkgtools
/var/lib/pkgtools/douninst.sh
/var/lib/pkgtools/packages
/var/lib/pkgtools/packages/testdisk-7.1-x86_64-1_rava
/var/lib/pkgtools/scripts
/var/lib/pkgtools/scripts/testdisk-7.1-x86_64-1_rava
/var/lib/pkgtools/setup
/var/lib/pkgtools/setup/tmp
/var/log
/var/log/packages
/var/log/pkgtools
/var/log/pkgtools/removed_packages
/var/log/pkgtools/removed_scripts
/var/log/scripts
/var/log/setup
you will find the binaries to first test in here:
/home/guest/Downloads/testdisk-WIP-7.2_2023.08-x86_64_Ed_P/usr/bin/

Execute the test-wise e.g. like so:

Move into the folder:

Code: Select all

cd /home/guest/Downloads/testdisk-WIP-7.2_2023.08-x86_64_Ed_P/usr/bin/
execute it manually - testdisk now should be a symlink to testdisk_static - the August 2023 version you just extracted and used to overwrite the older version from my older module:

Code: Select all

./testdisk
The initial ./ is essential since /home/guest/Downloads/testdisk-7.2_2023.08-x86_64_Ed_P/usr/bin/ is not part of your $PATH

When testdisk works as it should create the module as root via
dir2xzm /home/guest/Downloads/testdisk-WIP-7.2_2023.08-x86_64_Ed_P /home/guest/Downloads/testdisk-WIP-7.2_2023.08-x86_64_Ed_P.xzm
Copy or move testdisk-WIP-7.2_2023.08-x86_64_Ed_P.xzm onto a partition outside your union FS and activate it.
Again test it, this time just as

Code: Select all

testdisk
since you put its binaries into /usr/bin/

Enjoy your self-made module.

Do not share the module unless the issue I described in TestDisk & PhotoRec 7.2 WIP 2023.08 is resolved.
Cheers!
Yours Rava

User avatar
Ed_P
Contributor
Contributor
Posts: 8912
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#28 by Ed_P » 22 Sep 2023, 00:45

Wow! :o That's a lot of steps Rava. Thank you for posting them. :beer:

User avatar
Rava
Contributor
Contributor
Posts: 5424
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#29 by Rava » 22 Sep 2023, 00:57

^
You are welcome, and you are correct. I ponder if I should make a more generic post out of this to post in my Ravas coding goodies since there are a few programs out there that come only as tar archives but not as some kind of Linux package and all need the same approach.

Of course then I would write something like
When there exists an older working module you can use that extracted module as a template. (example similar to what I wrote above)
When no such module exists you have to create all needed folders and sub-folders for yourself or your module will not work.
(example only explaining bin/ and man/ directories and where to correctly put in an existing name.desktop file - making it clear that there exist other essential files and folders for any random tar archive and I cannot cover all theoretical possibilities of needed folder hierarchies)
Added in 8 minutes 20 seconds:
Rava wrote:
22 Sep 2023, 00:57
I ponder if I should make a more generic post out of this to post in my Ravas coding goodies
Lazy me will put that on my backburner for now for a wet and rainy day I hope will come since I had it with too dry and too hot weather (seasonally-wise speaking) .
Cheers!
Yours Rava

User avatar
Ed_P
Contributor
Contributor
Posts: 8912
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#30 by Ed_P » 22 Sep 2023, 06:06

Where's the executables? :hmmm:

Code: Select all

guest@porteus:/mnt/sda1/Guest/Downloads$ ./tarbz2*.sh
--2023-09-22 02:08:52--  https://www.cgsecurity.org/testdisk-7.2-WIP.linux26-x86_64.tar.bz2
Resolving www.cgsecurity.org (www.cgsecurity.org)... 193.168.50.236
Connecting to www.cgsecurity.org (www.cgsecurity.org)|193.168.50.236|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 7391262 (7.0M) [application/x-bzip2]
Saving to: ‘testdisk-7.2-WIP.linux26-x86_64.tar.bz2’

testdisk-7.2-WIP.li 100%[===================>]   7.05M  2.09MB/s    in 3.6s    

2023-09-22 02:08:57 (1.98 MB/s) - ‘testdisk-7.2-WIP.linux26-x86_64.tar.bz2’ saved [7391262/7391262]

tar xjf testdisk-7.2-WIP.linux26-x86_64.tar.bz2 -C /tmp/mod
/tmp/mod:
total 0
drwxr-xr-x 3 users 360 Aug 23 12:26 testdisk-7.2-WIP

/tmp/mod/testdisk-7.2-WIP:
total 23M
-rw-r--r-- 1 users   41 Aug 23 12:26 VERSION
drwxr-xr-x 2 users   60 Aug 23 12:26 l
-rwxr-xr-x 1 users 4.0M Aug 23 12:26 fidentify_static
-rwxr-xr-x 1 users  11M Aug 23 12:26 photorec_static
-rwxr-xr-x 1 users 8.3M Aug 23 12:26 testdisk_static
-rw-r--r-- 1 users  916 Aug 23 12:26 fidentify.8
-rw-r--r-- 1 users 1.2K Aug 23 12:26 photorec.8
-rw-r--r-- 1 users 1.8K Aug 23 12:26 testdisk.8
-rw-r--r-- 1 users  117 Jan 21  2023 INFO
-rw-r--r-- 1 users 2.2K Mar 26  2022 README.md
-rw-r--r-- 1 users  20K Jul  7  2019 NEWS
-rw-r--r-- 1 users  301 Jul  7  2019 readme.txt
-rw-r--r-- 1 users  504 Dec 24  2017 documentation.html
-rw-r--r-- 1 users  344 Apr 21  2008 THANKS
-rw-r--r-- 1 users  216 Nov 11  2007 AUTHORS
-rw-r--r-- 1 users  18K Jun 15  2006 COPYING

/tmp/mod/testdisk-7.2-WIP/l:
total 4.0K
-rw-r--r-- 1 users 1.7K Jan 18  2023 linux

Post Reply