mirror of
https://github.com/monero-project/monero.git
synced 2025-01-05 10:29:34 +00:00
check for windows NTFS compression on monerod startup
This commit is contained in:
parent
941ecefab2
commit
d9dbc49f3b
1 changed files with 27 additions and 0 deletions
|
@ -120,6 +120,18 @@ bool isFat32(const wchar_t* root_path)
|
|||
|
||||
return wcscmp(L"FAT32", &fs[0]) == 0;
|
||||
}
|
||||
|
||||
bool isNtfsCompressed(const wchar_t* file_path)
|
||||
{
|
||||
DWORD file_attributes = ::GetFileAttributesW(file_path);
|
||||
if (file_attributes == INVALID_FILE_ATTRIBUTES)
|
||||
{
|
||||
MERROR("Failed to get '" << file_path << "' file attributes. Error code: " << ::GetLastError());
|
||||
return false;
|
||||
}
|
||||
|
||||
return file_attributes & FILE_ATTRIBUTE_COMPRESSED;
|
||||
}
|
||||
#endif
|
||||
|
||||
int main(int argc, char const * argv[])
|
||||
|
@ -262,6 +274,21 @@ int main(int argc, char const * argv[])
|
|||
{
|
||||
MERROR("Data directory resides on FAT32 volume that has 4GiB file size limit, blockchain might get corrupted.");
|
||||
}
|
||||
|
||||
// Check for NTFS compression on both the data folder and the lmdb folder
|
||||
// Compression can corrupt the blockchain on disk
|
||||
if (isNtfsCompressed(data_dir.c_str()))
|
||||
{
|
||||
MERROR("Data directory is using NTFS compression, blockchain might get corrupted.");
|
||||
}
|
||||
bf::path db_path {bf::path(data_dir) / "lmdb"};
|
||||
if (bf::exists(db_path))
|
||||
{
|
||||
if (isNtfsCompressed(db_path.c_str()))
|
||||
{
|
||||
MERROR("Database directory is using NTFS compression, blockchain might get corrupted.");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// FIXME: not sure on windows implementation default, needs further review
|
||||
|
|
Loading…
Reference in a new issue