rejetto forum

Software => HFS ~ HTTP File Server => Topic started by: alexfmos on June 15, 2021, 05:48:23 AM

Title: Why file system cleared?
Post by: alexfmos on June 15, 2021, 05:48:23 AM
Server work many years. Today i found clean file system (more precisely, there was one file instead of many). I have backup, but what happened? In log i don't found anything
Title: Re: Why file system cleared?
Post by: vladimirov70 on June 19, 2021, 06:52:19 PM
I had a similar situation at the end of May. Perhaps this is a hacker attack. In my case, a complex virtual file system was damaged. Failed to restore. Now I'm switching to real folders in HFS, it's more reliable.
Title: Re: Why file system cleared?
Post by: D on October 04, 2021, 07:25:25 AM
Same, and my backup got overwritten by autosave :(
Title: Re: Why file system cleared?
Post by: LeoNeeson on October 04, 2021, 08:26:05 AM
To having a clue of why this happens, it would be nice if you comment this info (useful in any bug/error/issue report):
- What HFS version are you using?
- What Operating System are you using?
- Do you have any Antivirus or File Cleaners that could delete .vfs files?


Same, and my backup got overwritten by autosave :(
This gives me an idea, that HFS could have 'by-default' a daily backup, based on date (with a configurable option to set how many days would you like to keep a VFS backup), with file name using this scheme:
Code: [Select]
MySharedFiles.vfs.20211002.bak
MySharedFiles.vfs.20211003.bak
MySharedFiles.vfs.20211004.bak
(Where '20211004' is today 2021-10-04)
By having that option, if something goes wrong, you could manually restore a backup from some days ago.
Title: Re: Why file system cleared?
Post by: danny on October 08, 2021, 05:09:00 PM
In addition to Leo's good backup idea...

You could try the WatchCat script. 
If you hfs menu > save settings > to file
then the watchcat script will backup and then roll back to working settings if an error occurs while HFS is running
see that copy command (one in startup for backup and one in error for rollback) and notice that it could be expanded to first back up the vfs and then utilize the backup on the fly if errors occurred. 

Those features of the watchcat2 script are for the purpose of 'locking down' working condition.  So, you'd first get HFS running as you like. . . and afterwards start up the watchcat script to make HFS stay put. 

For example (watchcat edited to include vfs backup and restore):
Code: [Select]
@echo off
copy hfs.ini hfsini.bak /y
copy myvfs.vfs myvfs.bak /y
CLS
@echo       /\     /\
@echo      {  '''''  }
@echo     _{_ O   O _}_
@echo WatchCat is now running
:ONE
timeout /t 30 > nul
VER > nul
wget 127.0.0.1:80/favicon.ico --output-document=nul --quiet --wait=10 --tries=3
IF %ERRORLEVEL% NEQ 0 GOTO TWO
GOTO ONE
:TWO
@echo !
@echo HFS did not respond.
@echo Exiting...
date /T
time /T
TASKKILL /IM hfs.exe /F > nul
timeout /t 3 > nul
@echo ------------------------
copy myvfs.bak myvfs.vfs /y >nul
copy hfsini.bak hfs.ini /y > nul
timeout /t 2 > nul
@echo Starting HFS
start "" "hfs.exe" -c start-minimized=yes -c active=yes
GOTO ONE
if not port 80, be sure to put the actual port number
if not myvfs.vfs, be sure to use the actual file name
wget is in the zip file:  https://rejetto.com/forum/index.php?topic=12055.msg1065322#msg1065322

Title: Re: Why file system cleared?
Post by: alexfmos on September 28, 2022, 05:42:43 AM
Well, it happens again.
Quote
- What HFS version are you using?
- What Operating System are you using?
- Do you have any Antivirus or File Cleaners that could delete .vfs files?
HFS 2.4.0 RC6
Win 10 all updates
No
Title: Re: Why file system cleared?
Post by: Mars on September 28, 2022, 07:19:57 PM
for once it would have been necessary to note the date of creation of the empty vfs file, to determine if it was a new file created as part of a data backup or if there was loss of the complete file with recreation of a new but virgin,
this date could also have been compared with the log of windows application and system events and allowed to have an idea of ​​the cause of this phenomenon.

To tell the truth, this seems to be a fairly exceptional phenomenon over time, if it were more often recurrent, we could consider an in-depth study to try to reproduce it. At this stage it is wiser to make backups at regular intervals

the subject remains open to follow-up in the event of a shorter recurrence

by HFS scripts it is certainly possible to test the size of the current vfs and in the event of an incident to restore the last backup without the administrator having to intervene too late while issuing an alert to this one in the form of an email or other means of communication available from the server

we can test the existence of a hidden virtual file in the vfs as a reference point, and if this one disappears this means that the vfs had a problem, hfs can then react accordingly
Title: Re: Why file system cleared?
Post by: LeoNeeson on October 04, 2022, 09:08:56 AM
@Mars: Your comment leads me to have this 'theoretical' idea: how about setting up the 'System' file attribute, on the VFS file?. In this way, the file should be considered important enough to not be deleted by Windows or other file utilities. This way, we could discard that some external program could be automatically deleting the file (and concentrate the efforts on knowing if it's an HFS's problem). The 'System' attribute could be changed using Attrib (https://ss64.com/nt/attrib.html) or BulkFileChanger (http://www.nirsoft.net/utils/bulk_file_changer.html) (or any other file utility). What do you think? Is a good or bad idea? (or is useless?)
Title: Re: Why file system cleared?
Post by: Mars on October 05, 2022, 07:06:04 AM
the track seems unreliable, the system attributes are not sufficient to prevent a program other than hfs from accessing the VFS file.

I don't see any other solution as it stands than managing a copy of the vfs outside of hfs.

an important thing is to always activate "backup on save" in "Menu > Virtual File System" in order to keep a valid copy
Title: Re: Why file system cleared?
Post by: alexfmos on July 26, 2023, 07:32:47 AM
Just for info - it happened again. I have backup of course, but still dont know why it's happening. Also after last clear (09.2022) i move hfs to Stunnel for best security.