FreeBSD 启动时自动挂载 NTFS 分区

发布于 2024-07-07 06:39:20 字数 527 浏览 6 评论 0原文

我正在寻找在 FreeBSD 6.2 上以读/写模式挂载 NTFS 硬盘的方法。

搜索谷歌,我发现 NTFS-3G 可以提供帮助。

使用NTFS-3G,当我尝试手动挂载/卸载NTFS时没有问题:

挂载:ntfs-3g /dev/ad1s1 /home/admin/data -o uid=1002,

umount:umount /home/admin/data

但是当我尝试在启动时自动挂载ntfs硬盘时遇到问题。

我尝试过:

  • 添加 fstab: /dev/ad1s1 /home/admin/data ntfs-3g uid=1002 0 0
  • 制作一个脚本,在启动时自动挂载 ntfs 分区,在 /usr/local/etc/rc.d/ 上目录。

但仍然失败了。 该脚本在手动执行时效果良好。

有谁知道在 FreeBSD 6.2 上读/写访问 NTFS 的替代方法/解决方案?

谢谢。

I am looking for the way to mount NTFS hard disk on FreeBSD 6.2 in read/write mode.

searching google, I found that NTFS-3G can be a help.

Using NTFS-3G, there is no problem when I try to mount/unmount NTFS manually:

mount: ntfs-3g /dev/ad1s1 /home/admin/data -o uid=1002,

or

umount: umount /home/admin/data

But I have a problem when try to mount ntfs hard disk automatically at boot time.

I have tried:

  • adding fstab: /dev/ad1s1 /home/admin/data ntfs-3g uid=1002 0 0
  • make a script, that automatically mount ntfs partition at start up, on /usr/local/etc/rc.d/ directory.

But it is still failed.
The script works well when it is executed manually.

Does anyone know an alternative method/ solution to have read/write access NTFS on FreeBSD 6.2?

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

梦初启 2024-07-14 06:39:20

您的脚本运行在什么级别? 它是 S99 或更低版本吗?

听起来要么是安装时未加载依赖项,要么尝试使用脚本安装的用户无法成功。

在您的脚本中,我建议添加 sudo 以确保挂载由 root 执行:

/sbin/sudo /sbin/mount ntfs-3g /dev/ad1s1 /home/admin/data -o uid=1002, etc

将 sbin 交换到二进制文件所在的位置。

What level was your script running at? Was it a S99, or lower?

It sounds like either there is a dependency that isn't loaded at the time you mount, or that the user who is trying to mount using the script isn't able to succeed.

In your script I suggest adding a sudo to make sure that the mount is being performed by root:

/sbin/sudo /sbin/mount ntfs-3g /dev/ad1s1 /home/admin/data -o uid=1002, etc

Swap the sbin for wherever the binaries are.

庆幸我还是我 2024-07-14 06:39:20

经过我之前尝试过的一些方法。
最后,我尝试通过更改 mount.c 上的挂载脚本来添加 ntfs-3g 支持
像这样:

use_mountprog(const char *vfstype)

{

    /* XXX: We need to get away from implementing external mount
     *      programs for every filesystem, and move towards having
     *      each filesystem properly implement the nmount() system call.
     */

    unsigned int i;
    const char *fs[] = {
    "cd9660", "mfs", "msdosfs", "nfs", "nfs4", "ntfs",
    "nwfs", "nullfs", "portalfs", "smbfs", "udf", "unionfs",
    "ntfs-3g"
    NULL
    };

    for (i = 0; fs[i] != NULL; ++i) {
            if (strcmp(vfstype, fs[i]) == 0)
                    return (1);
    }

    return (0);

}

重新编译挂载程序,它就可以工作了!

谢谢...

After some ways I tried before.
The last, I tried to add ntfs-3g support by change the mount script on mount.c
Like this:

use_mountprog(const char *vfstype)

{

    /* XXX: We need to get away from implementing external mount
     *      programs for every filesystem, and move towards having
     *      each filesystem properly implement the nmount() system call.
     */

    unsigned int i;
    const char *fs[] = {
    "cd9660", "mfs", "msdosfs", "nfs", "nfs4", "ntfs",
    "nwfs", "nullfs", "portalfs", "smbfs", "udf", "unionfs",
    "ntfs-3g"
    NULL
    };

    for (i = 0; fs[i] != NULL; ++i) {
            if (strcmp(vfstype, fs[i]) == 0)
                    return (1);
    }

    return (0);

}

Recompile the mount program, and it works!

Thanks...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文