Page 1 of 1

Porteus unintentially truncates files

Posted: 10 Apr 2021, 20:06
by Buurman
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 ?

Porteus unintentially truncates files

Posted: 10 Apr 2021, 23:16
by ncmprhnsbl
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

Porteus unintentially truncates files

Posted: 11 Apr 2021, 19:43
by Buurman
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: