# My ntfs / ext4 drive disks cannot be mount from the /etc/fstab file.



## ziomario (Aug 7, 2021)

Hello.

I've created the script below to mount all the disk drives connected to my PC :

#Linux :


```
lklfuse -o type=ext4 /dev/ada0s1 /mnt/ada0s1 # CT500 (466 GB / Ubuntu 21.04)
lklfuse -o type=ext4 /dev/ada1p3 /mnt/ada1p3 # Samsung SSD 860 EVO 500GB / nixos
lklfuse -o type=ext4 /dev/da1p1 /mnt/da1p1   # Toshiba (932G)
lklfuse -o type=ext4 /dev/da2s1 /mnt/da2s1   # 1.8T Toshiba
```

#Windows :


```
ntfs-3g /dev/nvd0p2 /mnt/nvd0p2 # Windows da 900GB
ntfs-3g /dev/da0p1 /mnt/da0p1 # Elements
ntfs-3g /dev/da3p2 /mnt/da3p2 # 1.8T Seagate
```


#FreeBSD :


```
mount -t ufs /dev/ada1p2 /mnt/ada1p2 # Samsung SSD 860 EVO 500GB / FreeBSD da 100 GB
```


I would like to mount those disks automatically as soon as FreeBSD boot.  So,I've added these entries in the file /etc/fstab



```
/dev/ada0s1    /mnt/ada0s1     ext4    rw      1       1
/dev/ada1p3    /mnt/ada1p3     ext4    rw      1       1
/dev/da1p1     /mnt/da1p1      ext4    rw      1       1
/dev/da2s1     /mnt/da2s1      ext4    rw      1       1
/dev/nvd0p2    /mnt/nvd0p2     ntfs-3g rw      1       1
/dev/da0p1     /mnt/da0p1      ntfs-3g rw      1       1
/dev/da3p2     /mnt/da3p2      ntfs-3g rw      1       1
/dev/ada1p2    /mnt/ada1p2     ufs     rw      1       1
```

it didn't work. But where is the mistake ?


----------



## Alain De Vos (Aug 7, 2021)

Verify the output when you run "mount -a".
man ntfs-3g

```
/etc/fstab entry for the above (the sixth and last field has to be zero 
       to avoid a file system check at boot time) : 
               /dev/sda5 /home/user/mnt ntfs-3g ro,uid=1000 0 0
```


----------



## ziomario (Aug 7, 2021)

/dev/nvd0p2    /mnt/nvd0p2   ntfs-3g ro,uid=1000     0       0
/dev/da0p1     /mnt/da0p1      ntfs-3g ro,uid=1000     0       0
/dev/da3p2     /mnt/da3p2      ntfs-3g ro,uid=1000     0       0


----------



## ziomario (Aug 7, 2021)

I've also added these commands inside the file /root/.xinitrc,but even in this case,no disk has been mounted.


```
lklfuse -o type=ext4 /dev/ada0s1 /mnt/ada0s1                              
lklfuse -o type=ext4 /dev/ada1p3 /mnt/ada1p3                                  
lklfuse -o type=ext4 /dev/da1p1 /mnt/da1p1                  
lklfuse -o type=ext4 /dev/da2s1 /mnt/da2s1                
ntfs-3g /dev/nvd0p2 /mnt/nvd0p2                  
ntfs-3g /dev/da0p1 /mnt/da0p1          
ntfs-3g /dev/da3p2 /mnt/da3p2              
mount -t ufs /dev/ada1p2 /mnt/ada1p2
```


----------



## Alain De Vos (Aug 7, 2021)

Remove the lines from /etc/fstab.
Boot in a normal way.

Add your new lines to /etc/fstab
Do a manual explicit mount e.g.
mount /mnt/ada0s1
mount /mnt/ada0s1
mount /mnt/da1p1
mount /mnt/da2s1
mount /mnt/nvd0p2
mount /mnt/da3p2
mount /mnt/ada1p2
And check for errors.
If no errors are given, leave the lines in /etc/fstab.


----------



## eternal_noob (Aug 7, 2021)

What Alain De Vos said. In addition:


ziomario said:


> /root/.xinitrc


Never ever start X as root. It's a security risk.


----------



## Tieks (Aug 7, 2021)

All three errors have to do with ntfs-3g. Is that properly installed and does it indeed support RW-access instead of RO?


----------



## ziomario (Aug 7, 2021)

I mount every disk using the desktop manager xfce4. I don't get errors. This is the script that I use :

lklfuse -o type=ext4 /dev/ada0s1 /mnt/ada0s1 # CT500 (466 GB / Ubuntu 21.04)
lklfuse -o type=ext4 /dev/ada1p3 /mnt/ada1p3 # Samsung SSD 860 EVO 500GB / nixos
lklfuse -o type=ext4 /dev/da1p1 /mnt/da1p1   # Toshiba (932G)
lklfuse -o type=ext4 /dev/da2s1 /mnt/da2s1   # 1.8T Toshiba

ntfs-3g /dev/nvd0p2 /mnt/nvd0p2 # Windows da 900GB
ntfs-3g /dev/da0p1 /mnt/da0p1 # Elements
ntfs-3g /dev/da3p2 /mnt/da3p2 # 1.8T Seagate

mount -t ufs /dev/ada1p2 /mnt/ada1p2 # Samsung SSD 860 EVO 500GB / FreeBSD da 100 GB

Today at 6:11 PM I've added these to /etc/fstab :

/dev/nvd0p2    /mnt/nvd0p2   ntfs-3g ro,uid=1000     0       0
/dev/da0p1     /mnt/da0p1      ntfs-3g ro,uid=1000     0       0
/dev/da3p2     /mnt/da3p2      ntfs-3g ro,uid=1000     0       0

Tieks : as u can see I've used the parameter ro,not the parameter rw,but I've got the error that u see on the screnshot.


----------



## memreflect (Aug 8, 2021)

Here's what I did to get NTFS working:

Added "fusefs" to kld_list in rc.conf(5), so the fusefs(5) module is loaded at boot time
Added the following line to fstab(5):

```
/dev/da0p1    /mnt/da0p1    ntfs    rw,failok,late,uid=1001,dmask=022,fmask=133,mountprog=/usr/local/bin/ntfs-3g    0    0
```


Explanation of the options that I used:

*rw* - mount the device with read-write access
*failok* - ignore any errors that prevent the device from being mounted
*late* - mount the device after networked file systems are mounted; driver modules listed in rc.conf(5) are already loaded by this point, including fusefs
*uid=1001* - 1001 is my normal user's UID; id(1) is a great tool for getting this information, if you didn't already know about it
*dmask=022* - directories will have 755/drwxr-xr-x permissions (dmask=022 is equivalent to `chmod u=rwx,go=rx` for all directories); every user can read and navigate directories, but the user with UID 1001 can also create, modify, and delete directory information
*fmask=133* - files will have 644/rw-r--r-- permissions (fmask=133 is equivalent to `chmod u=rw,go=r` for all files); every user can read files, but the user with UID 1001 can also create, modify, and delete files
*mountprog=/usr/local/bin/ntfs-3g* - the program to use for mounting the device
Other useful options might be *noauto* and *untrusted* for removable USB devices.  If your machine is used by multiple people and you want them to be able to do more than read files and directories on the mounted partition, you may also want to look at the *gid=GID* option; don't forget to change the restrictive file and directory masks (fmask, dmask) as well.  You may want to change to something like *fmask=022* anyway if *fmask=133* is too restrictive.  For more info about these and other possible mount options, see fstab(5) for special ones like *rw* and *failok*, mount(8) for general mount options, and ntfs-3g(8) for NTFS-specific mount options.


----------



## ziomario (Aug 10, 2021)

I'm trying to mount the ext4 partitions mounting them on the fstab file. I've read how to do it properly reading from this site :









						Solved - Mounting a logical ext4 partition in  FreeBSD
					

Hi I want to mount my ext4 partition in FreeBSD. It is a logical partition (/dev/sda5 in linux). In FreeBSD it is shown as:  [root@pc ~]# gpart show ada0s3 =>         0  1251235840  ada0s3  EBR  (597G)            0  1251235840       1  linux-data  (597G)  I have tried following:  [root@pc~]...




					forums.freebsd.org
				




according to the site,this is the right syntax :

/dev/ada0s1    /mnt/ada0s1     fuse    rw,mountprog=/usr/local/bin/lklfuse,type=ext4,allow_other       0       0

and on the /etc/rc.conf I've added :

kld_list="fusefs"

it didn't work. below u can see the error that I get :


----------



## eternal_noob (Aug 10, 2021)

https://duckduckgo.com/?q=fuse+failed+to+open+device&ia=web
And please. Stop using photos of error messages. Post text instead.



ziomario said:


> and on the /etc/rc.conf I've added :
> 
> kld_list="fusefs"


This would actually overwrite your i195kms driver.

So this should be

```
kld_list="i195kms fusefs"
```


----------



## ziomario (Aug 10, 2021)

Man,I've commented the line "kld_list="i915kms" because I don't need it anymore,after having installed the package : xf86-video-intel. Did u read here ?

https://forums.freebsd.org/threads/...o-login-as-a-low-level-user.81645/post-526544

tell me,please,into which log file are saved the error messages that I see on the screen before that FreeBSD reach the login prompt.


----------



## Alain De Vos (Aug 10, 2021)

You can configure syslog to have console messages also send to /var/log/messages or /var/log/console.
"man syslog.conf"
In loader.conf i've set,

```
verbose_loading="YES"
```
In order to have "more" info.


----------



## ziomario (Aug 10, 2021)

For the future users who wants to learn how to mount the ntfs and the ext4 partitions on freebsd 13,these are the working parameters to use :


```
/dev/nvd0p2   /media/nvd0p2   ntfs    ro,failok,late,uid=1001,dmask=022,fmask=133,mountprog=/usr/local/bin/ntfs-3g    0    0
/dev/da0p1    /media/da0p1    ntfs    ro,failok,late,uid=1001,dmask=022,fmask=133,mountprog=/usr/local/bin/ntfs-3g    0    0
/dev/da3p2    /media/da3p2    ntfs    ro,failok,late,uid=1001,dmask=022,fmask=133,mountprog=/usr/local/bin/ntfs-3g    0    0

/dev/ada0s1     /media/ada0s1   fuse    ro,failok,late,mountprog=/usr/local/bin/lklfuse,type=ext4,allow_other   0       0
/dev/ada1p3     /media/ada1p3   fuse    ro,failok,late,mountprog=/usr/local/bin/lklfuse,type=ext4,allow_other   0       0
/dev/da2s1      /media/da2s1    fuse    ro,failok,late,mountprog=/usr/local/bin/lklfuse,type=ext4,allow_other   0       0

on /etc/fstab

kld_list="fusefs"

on /boot/loader.conf

fusefs_load="YES"
```


----------



## SirDice (Aug 10, 2021)

ziomario said:


> kld_list="fusefs" on /boot/loader.conf fusefs_load="YES"


Use `kld_list` or loader.conf to load kernel modules, not both. In this case you want to use loader.conf because `kld_list` is processed _after_ `FILESYSTEMS`.

The dividing line is simple, if you require it to boot the system put it in loader.conf, everything else can be loaded from `kld_list`.


----------



## eternal_noob (Aug 10, 2021)

SirDice said:


> In this case you want to use loader.conf
> ...
> if you require it to boot the system put it in loader.conf


Booting the system from NTFS / ext4?


----------



## SirDice (Aug 10, 2021)

eternal_noob said:


> Booting the system from NTFS / ext4?


Not exactly, but they're in /etc/fstab, so they get mounted pretty early in the boot sequence. With the `late` option you might get away with it and use `kld_list` to load fusefs(5).


----------

