1
0
mirror of https://github.com/veracrypt/VeraCrypt.git synced 2026-06-19 02:56:07 -05:00

Linux: allow mounting NTFS volumes with ntfs3 (#1695)

* Linux: allow mounting volumes with ntfs3

* Linux: add ntfs3 preference for NTFS mounts

* Linux: wrap ntfs3 preference help text

* Add Linux ntfs3 mount preference

* Remove Russian translation changes from ntfs3 PR

* XML Translations: Add English fallback entries for ntfs3 preference

---------

Co-authored-by: Mounir IDRASSI <mounir.idrassi@amcrypto.jp>
This commit is contained in:
Mammoth
2026-04-29 04:11:22 +03:00
committed by GitHub
parent 1b6f2690db
commit 771acf5951
55 changed files with 223 additions and 4 deletions
+9
View File
@@ -24,6 +24,9 @@ namespace VeraCrypt
TC_CLONE (CachePassword);
TC_CLONE (FilesystemOptions);
TC_CLONE (FilesystemType);
#ifdef TC_LINUX
TC_CLONE (MountNtfsWithNtfs3);
#endif
TC_CLONE_SHARED (KeyfileList, Keyfiles);
TC_CLONE_SHARED (DirectoryPath, MountPoint);
TC_CLONE (NoFilesystem);
@@ -62,6 +65,9 @@ namespace VeraCrypt
sr.Deserialize ("CachePassword", CachePassword);
sr.Deserialize ("FilesystemOptions", FilesystemOptions);
sr.Deserialize ("FilesystemType", FilesystemType);
#ifdef TC_LINUX
sr.Deserialize ("MountNtfsWithNtfs3", MountNtfsWithNtfs3);
#endif
Keyfiles = Keyfile::DeserializeList (stream, "Keyfiles");
@@ -132,6 +138,9 @@ namespace VeraCrypt
sr.Serialize ("CachePassword", CachePassword);
sr.Serialize ("FilesystemOptions", FilesystemOptions);
sr.Serialize ("FilesystemType", FilesystemType);
#ifdef TC_LINUX
sr.Serialize ("MountNtfsWithNtfs3", MountNtfsWithNtfs3);
#endif
Keyfile::SerializeList (stream, "Keyfiles", Keyfiles);
sr.Serialize ("MountPointNull", MountPoint == nullptr);
+6
View File
@@ -26,6 +26,9 @@ namespace VeraCrypt
MountOptions ()
:
CachePassword (false),
#ifdef TC_LINUX
MountNtfsWithNtfs3 (false),
#endif
NoFilesystem (false),
NoHardwareCrypto (false),
NoKernelCrypto (false),
@@ -51,6 +54,9 @@ namespace VeraCrypt
bool CachePassword;
wstring FilesystemOptions;
wstring FilesystemType;
#ifdef TC_LINUX
bool MountNtfsWithNtfs3;
#endif
shared_ptr <KeyfileList> Keyfiles;
shared_ptr <DirectoryPath> MountPoint;
bool NoFilesystem;
+34 -1
View File
@@ -566,6 +566,29 @@ namespace VeraCrypt
return GetMountedFilesystems (DevicePath(), mountPoint).size() == 0;
}
#ifdef TC_LINUX
string CoreUnix::DetectFilesystemType (const DevicePath &devicePath) const
{
list <string> args;
args.push_back ("-p");
args.push_back ("-o");
args.push_back ("value");
args.push_back ("-s");
args.push_back ("TYPE");
args.push_back ("--");
args.push_back (devicePath);
try
{
return StringConverter::ToLower (StringConverter::Trim (Process::Execute ("blkid", args, 2000)));
}
catch (...)
{
return string();
}
}
#endif
void CoreUnix::MountFilesystem (const DevicePath &devicePath, const DirectoryPath &mountPoint, const string &filesystemType, bool readOnly, const string &systemMountOptions) const
{
if (GetMountedFilesystems (DevicePath(), mountPoint).size() > 0)
@@ -914,8 +937,18 @@ namespace VeraCrypt
if (!options.NoFilesystem && options.MountPoint && !options.MountPoint->IsEmpty())
{
wstring filesystemType = options.FilesystemType;
#ifdef TC_LINUX
if (options.MountNtfsWithNtfs3 && filesystemType.empty()
&& DetectFilesystemType (loopDev) == "ntfs")
{
filesystemType = L"ntfs3";
}
#endif
MountFilesystem (loopDev, *options.MountPoint,
StringConverter::ToSingle (options.FilesystemType),
StringConverter::ToSingle (filesystemType),
options.Protection == VolumeProtection::ReadOnly,
StringConverter::ToSingle (options.FilesystemOptions));
}
+3
View File
@@ -65,6 +65,9 @@ namespace VeraCrypt
virtual void MountFilesystem (const DevicePath &devicePath, const DirectoryPath &mountPoint, const string &filesystemType, bool readOnly, const string &systemMountOptions) const;
virtual DevicePath MountAuxVolumeImage (const DirectoryPath &auxMountPoint, const MountOptions &options) const;
virtual void MountVolumeNative (shared_ptr <Volume> volume, MountOptions &options, const DirectoryPath &auxMountPoint) const { throw NotApplicable (SRC_POS); }
#ifdef TC_LINUX
string DetectFilesystemType (const DevicePath &devicePath) const;
#endif
private:
CoreUnix (const CoreUnix &);
+9 -1
View File
@@ -455,8 +455,16 @@ namespace VeraCrypt
// Mount filesystem
if (!options.NoFilesystem && options.MountPoint && !options.MountPoint->IsEmpty())
{
wstring filesystemType = options.FilesystemType;
if (options.MountNtfsWithNtfs3 && filesystemType.empty()
&& DetectFilesystemType (nativeDevPath) == "ntfs")
{
filesystemType = L"ntfs3";
}
MountFilesystem (nativeDevPath, *options.MountPoint,
StringConverter::ToSingle (options.FilesystemType),
StringConverter::ToSingle (filesystemType),
options.Protection == VolumeProtection::ReadOnly,
StringConverter::ToSingle (options.FilesystemOptions));