# UFS partition is auto mounting but in read only mode



## john_rambo (May 2, 2021)

Hi,
I am using GhostBSD which as you know is based on FreeBSD. I have a SSD on which GhostBSD is installed & I also have a spinning HDD with only 1 partition which I use to store data. When I was using Linux the data partition was EXT4 but later I backed up all data & formatted it to UFS because I thought its better to use a filesystem which FreeBSD supports fully.

The data partition is getting auto mounted but I can't write anything to it. Under Linux I used to use the command "chown" to gain write permission so decided to try it under FreeBSD too & it works but temporarily. What happens is after I use the chown command I gain write permission but as soon as I reboot the partition becomes read only again.

This is the command I using (after every reboot)


```
sudo chown -R  bsd /media/ada0p1/
```

Please tell me how to make the permission to persist.


----------



## bsduck (May 2, 2021)

If the data partition is on an internal disk, you should add it to /etc/fstab instead of letting an automounter handle it.

For example:
`/dev/ada0p1      /choose/your/mount/point               ufs     rw              0       2`

Otherwise check your automounter's settings, I don't know which one GhostBSD uses by default.


----------



## scottro (May 3, 2021)

Quick note. (I really hate to be "that guy", especially as I don't necessarily agree with the policy, but I'm nicer about telling people.) 









						GhostBSD, pfSense, TrueNAS, and all other FreeBSD Derivatives
					

Questions about 'derivative FreeBSDs', like  GhostBSD DesktopBSD TrueNAS XigmaNAS OPNsense pfSense PacBSD BSD Router Project NomadBSD helloSystem  should be asked on the forums and/or mailing lists for these specific products. See below for links.  If you still think your questions should be...




					forums.freebsd.org
				




There's another similar one about asking questions about CURRENT, and other unsupported versions. 








						GhostBSD, pfSense, TrueNAS, and all other FreeBSD Derivatives
					

Questions about 'derivative FreeBSDs', like  GhostBSD DesktopBSD TrueNAS XigmaNAS OPNsense pfSense PacBSD BSD Router Project NomadBSD helloSystem  should be asked on the forums and/or mailing lists for these specific products. See below for links.  If you still think your questions should be...




					forums.freebsd.org
				




There are some good reasons for this--for example, if posts about CURRENT were allowed, people would start fighting here about decisions made for FreeBSD's future, but basically, the forum asks that for questions about GhostBSD, or other derivatives, you look to their forums, or whatever support they offer.

There are workarounds. If you make it an I hate Linux, so I'm using GhostBSD, I hate Linux threads will go on for 3 pages. 
Or, even though it's sneaky, don't mention that you're asking about CURRENT, GhostBSD, etc. 

 However, note that in the post itself, the mods are kind enough to give ways to ask, assuming you meet some prerequisites. The other way is to rephrase the question,  such as, I'm having this problem in GhostBSD, has anyone experienced the same in FreeBSD?


----------



## john_rambo (May 3, 2021)

bsduck 
That single line of code is looks very simple but since GhostBSD uses auto mount feature by default I am worried if I add that line to fstab it may make my system unbootable. I don't have the necessary knowledge to recover from that kind of a situation. So I will wait for someone who knows for sure how to deal with this.

scottro 

https://forums.freebsd.org/threads/ghostbsd-pfsense-truenas-and-all-other-freebsd-derivatives.7290/



> To show that you have indeed tried to get a solution from the forum or mailing list of the FreeBSD derivative in question, you may be asked to provide a link to a forum post or a mailing list message demonstrating that you asked the proper community for help first. _You cannot expect the FreeBSD community to support all derivative and spin-off projects._



My username at GhostBSD forums is security_lover. This is my thread :

https://forums.ghostbsd.org/viewtopic.php?f=61&t=1934&p=9392#p939


----------



## George (May 3, 2021)

Ghostbsd uses autofs.






						/etc/autofs/ - GhostBSD Wiki
					






					wiki.ghostbsd.org


----------



## john_rambo (May 3, 2021)

Elazar said:


> Ghostbsd uses autofs.
> 
> 
> 
> ...


I read that wiki page very carefully but couldn't figure out what to do to solve this issue. I am just newbie. Can you tell me exactly what am I supposed to do ?


----------



## George (May 3, 2021)

Since you used `chown` with success (and not `mount -u`), I think the partition is mounted read-write. Your user just doesn't have the proper permissions to access /media.


----------



## john_rambo (May 3, 2021)

Elazar said:


> Since you used `chown` with success (and not `mount -u`), I think the partition is mounted read-write. Your user just doesn't have the proper permissions to access /media.


Okay but why is the permission after reboot reverting back to root ? When I was using Linux after adding a partition to /etc/fstab & rebooting I couldn't write to that partition as a regular user so I used the chown command. The difference is under Linux I had to use the chown command just once & reboot. That's it. After that the regular user had read/write permissions.


----------



## mark_j (May 3, 2021)

There's a big difference between autofs and fstab, the latter being static. Once you chown the mount point it sticks until you change it.
With autofs, it mounts it according to devfs, auto_master and expects you to be in the wheel group.
If you read section 18.4.2 of the handbook,  where it says -nosuid as a mount option in auto_master, you can add other mount commands like -m 777 to mount rw to everybody. Also -autoro might help. Thus it looks like this:

```
/media        -media        -nosuid, -autoro, -m=770
```
(Apologies, spacing killed by quoting)


----------



## SirDice (May 3, 2021)

mark_j said:


> (Apologies, spacing killed by quoting)


Use [code]..[/code] instead of [quote]..[/quote].

Formatting Guidelines


----------



## john_rambo (May 3, 2021)

bsduck said:


> If the data partition is on an internal disk, you should add it to /etc/fstab instead of letting an automounter handle it.
> 
> For example:
> `/dev/ada0p1      /choose/your/mount/point               ufs     rw              0       2`
> ...


I unmounted the data partition then added it to fstab just like you suggested & finally rebooted.
Sadly it didn't work. Despite the entry in fstab GhostBSD is still auto mounting the partition.


```
> cat /etc/fstab
# Device        Mountpoint        FStype        Options    Dump Pass
procfs            /proc            procfs        rw        00
linprocfs        /compat/linux/proc    linprocfs    rw        00
tmpfs /compat/linux/dev/shm tmpfs rw,mode=1777 0 0
linsysfs /compat/linux/sys linsysfs rw 0 0
fdesc /dev/fd fdescfs rw 0 0
/dev/ada0p1 /home/bsd/spinning ufs     rw              0       2
```


Now I got 2 entries in my file manager (please see attachment).
When I click on the "spinning" which is the folder I created as a mount point for the partition I see an error message (please see attachment)


----------



## mark_j (May 4, 2021)

SirDice said:


> Use [code]..[/code] instead of [quote]..[/quote].
> 
> Formatting Guidelines


In my defence, I was writing it on a Samsung tablet and accessing the sub-menu of "more options" is problematic. I will try harder next time.


----------

