Bug 265193

Summary: sysutils/bsdisks: can't mount ext2/ext3/ext4
Product: Ports & Packages Reporter: bsduck <bsduck>
Component: Individual Port(s)Assignee: Gleb Popov <arrowd>
Status: Closed FIXED    
Severity: Affects Some People CC: grahamperrin, learnux
Priority: --- Flags: arrowd: maintainer-feedback+
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
Patch none

Description bsduck 2022-07-13 13:29:28 UTC
Hello,

A partition formatted with ext2, ext3 or ext4 currently can't be mounted from a file manager through bsdisks, at least on 13.1-STABLE and 13.1-RELEASE. Trying to do so just returns "Mount: failed with".

Adding support for them would be profitable because ext2/3/4 are natively supported on FreeBSD (no need for FUSE modules) and are convenient filesystems for disks meant to be used with both FreeBSD and Linux.
Comment 1 Gleb Popov freebsd_committer freebsd_triage 2022-07-13 13:30:36 UTC
Does mounting from the command line work? Can you show me commands you use for that?
Comment 2 bsduck 2022-07-19 13:39:34 UTC
Yes. One single command to rule them all:

$ mount -t ext2fs -o async /device /mountpoint

The command requires the ext2fs kernel module to be loaded before, or else to be run as root (in which case it will load the module automatically).

'-o async' is necessary to get a decent writing speed with ext4 (ext2 and ext3 are mounted asynchronous by default).
Comment 3 learnux 2022-11-09 05:57:30 UTC
Hello,
You can create a link to fuse-ext2.
ln -s /usr/local/bin/fuse-ext2 /usr/local/bin/fuse2fs

If you don't want to use the FUSE module you must modify the blockfilesystem.cpp source file and recompile sysutils/bsdisks.

else if(filesystem == "ext2fs")
    {
        mountProg = QStringLiteral("fuse2fs");

        args << QStringLiteral("-o") << (QStringLiteral("uid=") + QString::number(uid));
        args << QStringLiteral("-o") << QStringLiteral("allow_other");
    }

else if(filesystem == "ext2fs")
    {
        mountProg = QStringLiteral("/sbin/mount");

        args << QStringLiteral("-t") << QStringLiteral("ext2fs");
        args << QStringLiteral("-o") << QStringLiteral("async");
    }
Comment 4 learnux 2022-11-10 18:54:02 UTC
Please correct:
fuse-ext2 → fusefs-ext2
Comment 5 Gleb Popov freebsd_committer freebsd_triage 2022-11-22 18:57:56 UTC
Created attachment 238260 [details]
Patch

bsduck, can you please rebuild the port with this patch and see if this fixes the problem for you?

Drop this into ${PORTSDIR}/sysutils/files/ directory and it will be picked up by the build.
Comment 6 learnux 2022-11-22 22:45:30 UTC
This is work for me!!!
But I suggest you replace findExecutable('fuse2fs') with findExecutable('fuse-ext2').
Indeed, the fuse2fs executable does not exist in FreeBSD but fuse-ext2, provided by sysutils/fusefs-ext2.
Comment 7 commit-hook freebsd_committer freebsd_triage 2022-11-23 08:42:04 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=b75bbc23fd742d2223b17bb5f50188ee34b07521

commit b75bbc23fd742d2223b17bb5f50188ee34b07521
Author:     Gleb Popov <arrowd@FreeBSD.org>
AuthorDate: 2022-11-23 08:40:30 +0000
Commit:     Gleb Popov <arrowd@FreeBSD.org>
CommitDate: 2022-11-23 08:41:14 +0000

    sysutils/bsdisks: Update to 0.28

    Add support for FreeBSD-native ext2 filesystem.

    PR:             265193

 sysutils/bsdisks/Makefile | 4 ++--
 sysutils/bsdisks/distinfo | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)
Comment 8 commit-hook freebsd_committer freebsd_triage 2022-11-23 08:43:06 UTC
A commit in branch 2022Q4 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=d3d47c9dcf4c7427ca922c1a571715d3e6cbd1bb

commit d3d47c9dcf4c7427ca922c1a571715d3e6cbd1bb
Author:     Gleb Popov <arrowd@FreeBSD.org>
AuthorDate: 2022-11-23 08:40:30 +0000
Commit:     Gleb Popov <arrowd@FreeBSD.org>
CommitDate: 2022-11-23 08:41:44 +0000

    sysutils/bsdisks: Update to 0.28

    Add support for FreeBSD-native ext2 filesystem.

    PR:             265193
    (cherry picked from commit b75bbc23fd742d2223b17bb5f50188ee34b07521)

 sysutils/bsdisks/Makefile | 4 ++--
 sysutils/bsdisks/distinfo | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)
Comment 9 bsduck 2023-02-19 21:11:25 UTC
This works well now! Thank you very much for the improvement.