Accessing ext4 from Windows
Perhaps a bit off subject. I'm not sure. But I figure there are folk here using ext4 file systems, so... I have a new requirement to be able to read/write ext4 file systems from Windows. It's like this: we have a data collection system that collects data to a mix of ext4 and vfat disks. For whatever reasons. We have usually accessed all of these from a Linux system where file system support is really great. Unfortunately, the powers that be have decided to set up a system that is Windows-only. Sigh. I have tried installing openSUSE Leap 15.6 in WSL 2. It actually works great. My motivation was that I should be able to mount the ext4 partition via wsl, and then access it in Windows. See, for example, https://windowsreport.com/ext4-windows-11/. That is sort of true if by 'access' you mean in Windows Explorer only. That is not a workable solution. I need access in programs and shell scripts. I then tried a product like Linux Reader. It is geared towards file recovery. Why anyone would use a Windows computer to try to recover files on an ext4 system is a real mystery. It also seemed to caution that it really wanted to be a read-only thing. Not a confidence booster. And not what I need. Finally, I tried Paragon Software's ext4 for Windows. It seems to be properly read/write and, generally looks great. But then I see that I cannot access SQLite databases that are on these disks. SQLite (general programs and database browsers) all complain that the database is locked. We had this issue when, from Linux, accessing databases on CIFS mounted drivers. That was sorted by adding nobrl to the CIFS mount command on Linux. It's a known issue. So this method was close, but no cigar. A support question is pending as I cannot think I am the first person who wanted to access an SQLite database this way. So my question here is if anyone has any experience with Windows software that lets one mount ext4 file systems read/write. It has to work from programs and shell scripts, not just in a file system browser GUI. -- Roger Oberholtzer
On Tue, Aug 13, 2024 at 12:23 PM Roger Oberholtzer <roger.oberholtzer@gmail.com> wrote:
So my question here is if anyone has any experience with Windows software that lets one mount ext4 file systems read/write. It has to work from programs and shell scripts, not just in a file system browser GUI.
You could try https://github.com/bobranten/Ext4Fsd I used ext2 driver for Windows long ago, it worked for my purposes.
On 8/13/24 4:23 AM, Roger Oberholtzer wrote:
So my question here is if anyone has any experience with Windows software that lets one mount ext4 file systems read/write. It has to work from programs and shell scripts, not just in a file system browser GUI.
Every time I've looked into this I've come away disappointed. Now granted it has been at least 5 years since I tried, but as you have found, there was always some limitation on read/write that made whatever access from Windows unrealistic. Maybe the company would allow an additional $14 in its budget for a "Pi Zero 2 W". (stick with the 32-bit Pi-OS, 2x faster than 64-bit - I've got one of each, but you do miss out on the joy of Arm8 assembly :) -- David C. Rankin, J.D.,P.E.
Le 13/08/2024 à 22:30, David C. Rankin a écrit :
Every time I've looked into this I've come away disappointed. Now granted it
you are right. If some body is really desperate, I think there is a company that sell drivers for nearly everything https://www.paragon-software.com/fr/about/products-a-to-z/#for_windows jdd -- https://dodin.org
On 13.8.2024 12.23, Roger Oberholtzer wrote:
I have tried installing openSUSE Leap 15.6 in WSL 2. It actually works great. My motivation was that I should be able to mount the ext4 partition via wsl, and then access it in Windows. See, for example, https://windowsreport.com/ext4-windows-11/. That is sort of true if by 'access' you mean in Windows Explorer only. That is not a workable solution. I need access in programs and shell scripts.
By programs I assume you mean CLI applications? You can access files on WSL2 mounted partitions via \\wsl$\<Distro>\<Mountpoint> path either from Command Prompt (cmd.exe) or from PowerShell (https://learn.microsoft.com/en-us/windows/wsl/wsl2-mount-disk#access-the-dis...). The documentation is a bit misleading, since it only mentions accessing the disk content from File Explorer, but the path does work in Command Prompt or PowerShell too.
Finally, I tried Paragon Software's ext4 for Windows. It seems to be properly read/write and, generally looks great. But then I see that I cannot access SQLite databases that are on these disks. SQLite (general programs and database browsers) all complain that the database is locked. We had this issue when, from Linux, accessing databases on CIFS mounted drivers. That was sorted by adding nobrl to the CIFS mount command on Linux. It's a known issue. So this method was close, but no cigar. A support question is pending as I cannot think I am the first person who wanted to access an SQLite database this way.
SQLite database file access seems to hinge on the fact that WSL2 mounted filesystems do not support file locking when accessed from the Windows side (https://github.com/microsoft/WSL/issues/4689, https://github.com/microsoft/WSL/issues/5762). Depending on your use case, you may be able to work around that problem by opening the SQLite database using file: URI and passing some query string parameters (nolock=1 or immutable=1): https://www.codejam.info/2021/10/bypass-sqlite-exclusive-lock.html https://www.sqlite.org/uri.html C:\Users\testuser>sqlite3 file:\\wsl$\opensuse-tumbleweed\mnt\wsl\backup\clementine.db SQLite version 3.46.0 2024-05-23 13:25:27 (UTF-16 console I/O) Enter ".help" for usage hints. sqlite> .databases main: \\wsl$\opensuse-tumbleweed\mnt\wsl\backup\clementine.db r/w sqlite> .tables Error: database is locked sqlite> .quit C:\Users\testuser>sqlite3 file:\\wsl$\opensuse-tumbleweed\mnt\wsl\backup\clementine.db?nolock=1 SQLite version 3.46.0 2024-05-23 13:25:27 (UTF-16 console I/O) Enter ".help" for usage hints. sqlite> .databases main: \\wsl$\opensuse-tumbleweed\mnt\wsl\backup\clementine.db r/w sqlite> .tables amazon_cloud_drive_songs podcast_episodes amazon_cloud_drive_songs_fts podcasts amazon_cloud_drive_songs_fts_content schema_version amazon_cloud_drive_songs_fts_segdir seafile_songs amazon_cloud_drive_songs_fts_segments seafile_songs_fts box_songs seafile_songs_fts_content box_songs_fts seafile_songs_fts_segdir box_songs_fts_content seafile_songs_fts_segments box_songs_fts_segdir skydrive_songs box_songs_fts_segments skydrive_songs_fts devices skydrive_songs_fts_content directories skydrive_songs_fts_segdir dropbox_songs skydrive_songs_fts_segments dropbox_songs_fts songs dropbox_songs_fts_content songs_fts ... sqlite> select playcount from songs where title = 'How Dare You'; 1 sqlite> update songs set playcount = 2 where title = 'How Dare You'; sqlite> select playcount from songs where title = 'How Dare You'; 2 sqlite> .quit C:\Users\testuser>sqlite3 file:\\wsl$\opensuse-tumbleweed\mnt\wsl\backup\clementine.db?immutable=1 SQLite version 3.46.0 2024-05-23 13:25:27 (UTF-16 console I/O) Enter ".help" for usage hints. sqlite> .databases main: \\wsl$\opensuse-tumbleweed\mnt\wsl\backup\clementine.db r/o sqlite> select playcount from songs where title = 'How Dare You'; 2 sqlite> update songs set playcount = 3 where title = 'How Dare You'; Runtime error: attempt to write a readonly database (8) sqlite> .quit -- Martti Laaksonen
On Wed, Aug 14, 2024 at 4:31 PM Martti Laaksonen <martti.laaksonen@sci.fi> wrote:
On 13.8.2024 12.23, Roger Oberholtzer wro SQLite database file access seems to hinge on the fact that WSL2 mounted filesystems do not support file locking when accessed from the Windows side
OP got this problem with the Paragon ext4 driver.
On 14.8.2024 16.39, Andrei Borzenkov wrote:
On Wed, Aug 14, 2024 at 4:31 PM Martti Laaksonen <martti.laaksonen@sci.fi> wrote:
On 13.8.2024 12.23, Roger Oberholtzer wro SQLite database file access seems to hinge on the fact that WSL2 mounted filesystems do not support file locking when accessed from the Windows side
OP got this problem with the Paragon ext4 driver.
Yes, I got that and just demonstrated that you can also access SQLite databases via WSL2 mount if you open it using file: URI with nolock or immutable query parameter. Without either one, you will get the same database locked errors when going through WSL2 mount. Besides, the same SQLite file: URI trick probably works with that Paragon driver too. Obviously you will want to make sure you are the only one accessing the database when using the nolock parameter. -- Martti Laaksonen
Le 14/08/2024 à 15:39, Andrei Borzenkov a écrit :
On Wed, Aug 14, 2024 at 4:31 PM Martti Laaksonen <martti.laaksonen@sci.fi> wrote:
On 13.8.2024 12.23, Roger Oberholtzer wro SQLite database file access seems to hinge on the fact that WSL2 mounted filesystems do not support file locking when accessed from the Windows side
OP got this problem with the Paragon ext4 driver.
if so ask Paragon jdd -- https://dodin.org
participants (5)
-
Andrei Borzenkov
-
David C. Rankin
-
jdd@dodin.org
-
Martti Laaksonen
-
Roger Oberholtzer