rejetto forum

HFS did not save the file system or can't restore it.

0 Members and 1 Guest are viewing this topic.

Offline vladimirov70

  • Occasional poster
  • *
    • Posts: 22
    • View Profile
    • Concept of Public Security
Hi! The essence of the problem. I transferred files from the hard disk C to an external SSD drive, the disk E. The URL of the files was obtained by dragging the files into the HFS window. Saved the file system to a file, copied it to 3 different locations.  It's important to me.
Yesterday there was a power failure of the laptop. After the reboot, I saw that the file system had changed. The condition is the same as it was one month ago. About 1000 URLs point to files that are no longer on disk C.

The attempt to restore the file system from file 1.vfs failed, everything remained the same. File 1.vfs.bak the HFS does not see it. The problem is in virtual and real folders, as well as in files without a folder.

I need the URLs in their previous form, as they are used in the video players on the site. The files are scattered in different folders and it takes a very long time to restore the file system manually in its previous form. There are 2 questions:
1. How to save the file system if "save file system" does not work?
2. Can I edit an virtual file system ? All at once. I need to change the path.
Replace disk C in them with disk E. For example  change  %u0421\%u041A%u0438%u043D%u043E%u0437%u0430%u043B\%u041C%u0443%u043B%u044C%u0442%u044B\2skazki.mp4  to E\%u041A%u0438%u043D%u043E%u0437%u0430%u043B\%u041C%u0443%u043B%u044C%u0442%u044B\2skazki.mp4  . 
The URL will be the same http://100kino515.ddns.net/Kinozal/2skazki.mp4
Thank you in advance! I attach the files 1. vfs  https://jmp.sh/2IdRAlZ and 1. vfs. bak https://jmp.sh/4BuSEXy and screenshots.

« Last Edit: June 16, 2021, 08:45:51 PM by vladimirov70 »
The end of times or the beginning of a new one? https://kob-alt.ru/kob-perevodi/


Offline NaitLee

  • Tireless poster
  • ****
    • Posts: 164
  • Computer brained boy
    • View Profile
    • A Normal Webpage
In case the vfs is small, it is uncompressed. You can open that vfs file with Notepad++ (not plain notepad.exe), then edit it as a file, replace all "C:\" as "E:\", finally save it.

If it's bigger than 10kb, then it's compressed, and should decompress it with some methods before editing.

I've checked HFS source code, but cannot understand how vfs file "chunk" works, thus I have no idea to decompress a vfs file with external tool.
Maybe someone else can explain this to us... :D
« Last Edit: May 29, 2021, 03:03:06 AM by NaitLee »
Check out my template and PHFS ;)


Offline vladimirov70

  • Occasional poster
  • *
    • Posts: 22
    • View Profile
    • Concept of Public Security
Thank you friend! That was my first thought, too. But when I open vfs file from Sublime Text (Notepad++ e.t.c.), I see , File 56 KB[/URL]
« Last Edit: May 29, 2021, 12:39:30 PM by vladimirov70 »
The end of times or the beginning of a new one? https://kob-alt.ru/kob-perevodi/


Offline LeoNeeson

  • Tireless poster
  • ****
    • Posts: 758
  • Status: On hiatus (sporadically here)
    • View Profile
    • twitter.com/LeoNeeson
I've checked HFS source code, but cannot understand how vfs file "chunk" works, thus I have no idea to decompress a vfs file with external tool.
Maybe someone else can explain this to us... :D
Search on 'main.pas' for 'addVFSheader' and you will see HFS is using ZLIB compression.



I've tried to decompress a VFS, and had "partial" success, following this steps...

WARNING: If you follow the next instructions, ALWAYS backup all your files first! Don't blame me if you do something wrong, or if you lose or corrupt some file, or if this doesn't work. If you choose to follow this, do it at your OWN risk.

1) Download Offzip 0.4.1 from HERE (it's a command line utility for doing zlib decompression).

2) If you have a VFS named example.vfs run offzip with this:

Code: [Select]
offzip -a -z 31 example.vfs C:\
This will generate a dat file, like for example: C:\00000046.dat

3) Then using a HEX Editor, edit your '00000046.dat' and change paths.

4) Finally you reimport/compress your edited dat file on the vfs, with:

Code: [Select]
offzip -a -r -z 31 example.vfs C:\
5) Open HFS and load your edited VFS, and you will get a warning message:

"This file is corrupted (CRC). Going on may lead to problems. It is adviced to stop loading. Stop?"

6) Click on 'Yes' and see if it works or not. In my case, it failed. :'(

So, feel free to experiment using this tool, until you get the exact method to extract the data.



@Rejetto: adding an option to temporally save the VFS as an uncompressed file (without using ZLIB compression), could come handy in case some advanced user wants to externally edit the VFS. Or even better adding an option to blindly change drive paths in a VFS, for example, from C:\ to E:\ as this user is wanting. As always, my disclaimer: I don't need this (and I'm sure you won't like to overload HFS with options, so, do what you think is best). :)

Cheers,
Leo.-
HFS in Spanish (HFS en Español) / How to compile HFS (Tutorial)
» Currently taking a break, until HFS v2.4 get his stable version.


Offline NaitLee

  • Tireless poster
  • ****
    • Posts: 164
  • Computer brained boy
    • View Profile
    • A Normal Webpage
I've gone deeper at early time, and found that a vfs file is consisted of "chunks", for example, the char \x18 (DEC 24) marks a part of zlib compressed data.  ::)

Also in classesLib.pas, something named "tlv" manages to read vfs file, but it's a little complex...

I tried with python zlib module, by simply splitting the file content with b'\x18' and decompress the parts, also failed  :'(
Check out my template and PHFS ;)


Offline vladimirov70

  • Occasional poster
  • *
    • Posts: 22
    • View Profile
    • Concept of Public Security
Thank you all for participating in solving the problem! I'll fix it gradually.
The end of times or the beginning of a new one? https://kob-alt.ru/kob-perevodi/