Porteus unintentially truncates files

Technical issues/questions of an intermediate or advanced nature.
Buurman
White ninja
White ninja
Posts: 25
Joined: 28 Oct 2019, 18:00
Distribution: ver5

Porteus unintentially truncates files

Post#1 by Buurman » 10 Apr 2021, 20:06

For the second time now Porteus 5 has messed up an existing file on an external network drive (ext4 linux nas). :evil:
I usually edit the contents of the files (simple text) on windows (via network, no problems there) (options are http, samba/cifs, nfs).
In the past and again now, i edited the file using porteus (leaf), with root access, save everything seems fine at first
but after trying to reopen the saved file, it is truncated ..to be precise, it is rounded down to the next exact cluster. last time file was cut(truncated) to exactly 96,0 kB (98.304 bytes) and this time 16,0 kB (16.384 bytes)
i'm guessing the remaining data is physically still on the disk ..how to get it back ?

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

Porteus unintentially truncates files

Post#2 by ncmprhnsbl » 10 Apr 2021, 23:16

looks like leafpad needs to be built with this patch: https://gitweb.gentoo.org/repo/gentoo.g ... eb7ea91f9a
edit: and looking at the source of l3afpad, something similiar might be relevant there too..
Buurman wrote:
10 Apr 2021, 20:06
i'm guessing the remaining data is physically still on the disk ..how to get it back ?
maybe form here: https://askubuntu.com/questions/403010/ ... -by#648794
"grep for some known string in the truncated file."

Code: Select all

grep -a -A 1000 -F 'some known string' \
    /dev/disk-device > recovered-file
Forum Rules : https://forum.porteus.org/viewtopic.php?f=35&t=44

Buurman
White ninja
White ninja
Posts: 25
Joined: 28 Oct 2019, 18:00
Distribution: ver5

Porteus unintentially truncates files

Post#3 by Buurman » 11 Apr 2021, 19:43

thnx a LOT (knew it wasn't my fault ..)
will have to take the disk out of the NAS and mount on a live-system ..
I approx. know how many lines might be missing so the -A and -B should give result quite easily (if not overwritten.. i didn't notice it immediately )


success :punk:

Post Reply