# FreeBSD on USB Flash: root remount from RW to RO takes 3 minutes



## Egor (Jun 27, 2012)

Hello, everybody!

I've installed freebsd FreeBSD on a USB stick, root partition mounted as read-only, /var and /tmp are mounted as md. Sometimes *I* need to mount root for writing, and then, when I call [CMD=""]mount -o ro /[/CMD] the server hangs for three minutes: sshd, named, and other network services are not responding, commands in other consoles are frozen too.

I've tried turning off softupdates, forcing mount with the -f option, single user mode - nothing helps.

[CMD=""]fstat[/CMD] doesnt show any read-write opened files on the root partition.

Does anyone knows how to fix it or what else I can try or check? I have FreeBSD 8.3.


----------



## jarosm (Jan 3, 2013)

Hi,

there are two ways:
1, easy - downgrade to 8.2-RELEASE
2, apply this patch - it's for pfsense distro and I have not yet tried it on FreeBSD, but I believe it will work.

On the second harder way you will have to change sysctl(8) variable 'vfs.forcesync'. I think.


----------



## SirDice (Jan 3, 2013)

jarosm said:
			
		

> 1, easy - downgrade to 8.2-RELEASE


Bad advice. FreeBSD 8.2 is end-of-life. It's not supported anymore.


----------



## Beeblebrox (Jan 3, 2013)

> and then, when I call
> mount -o ro /


1. When do you call this?
2. You of course mean
`# mount -o [FILE][b]rw[/b][/FILE] /`
3. Try temporarily changing the entry in /etc/fstab to rw and see what happens.


----------



## jarosm (Jan 3, 2013)

Beeblebrox said:
			
		

> 1. When do you call this?
> 2. You of course mean
> `# mount -o [FILE][b]rw[/b][/FILE] /`
> 3. Try temporarily changing the entry in /etc/fstab to rw and see what happens.




I think you get it wrong. Egor meant this:
When you open read only file system to write, write something, and close it back to read only...
`# mount -o rw /`
`# echo "test" >/some_file_in_root_fs`
`# mount -o ro /`

The last step is processing long time (circa 30 - 600 seconds - according to used medium). And every services what need reading from disk don't work. This problem has appeared in FreeBSD 8.3-RELEASE.


----------



## Beeblebrox (Jan 4, 2013)

jarosm : Aaah, thanks. That makes sense now.


----------



## kpa (Jan 7, 2013)

Does this have something to with UFS SU+J? Or is not available on 8.3?


----------



## jarosm (Jan 15, 2013)

kpa said:
			
		

> Does this have something to with UFS SU+J? Or is not available on 8.3?



I am not sure if I understand your questions, despite this I will try to answer.

1, No, this thread isn't about a SoftUpdate or/and a Journal.
2, Also I think the problem (topic of this thread) doesn't have solving in the SoftUpdate or in the Journal.
3, The SoftUpdate and the Journal are available on the 8.3-RELEASE, but it isn't the subject of this topic.
4, The problem was come with the 8.3-RELEASE, In the 8.2-RELEASE is working the remounting all right.


----------



## jarosm (May 6, 2013)

SirDice said:
			
		

> Bad advice. FreeBSD 8.2 is end-of-life. It's not supported anymore.



But just only one useful. 8.3-RELEASE-p8 still has same problem and uncommented "patch" looks little bit dangerous.

The problem isn't only time. It brings next worse problems: Some service doesn't answer (SSH, OpenVPN, MySQL) during a system making remount to 'ro'; When you manage the system on very long distance you could feel weak heart attack while you waiting to done it.


----------



## Tomtor (Dec 31, 2015)

This is still an issue on 11-CURRENT.

Reproduced on a Raspberry with micro SD card.


----------



## rickvanderzwet (Dec 15, 2020)

Tomtor said:


> This is still an issue on 11-CURRENT.
> 
> Reproduced on a Raspberry with micro SD card.


It ever made it to FreeBSD, see PR 176169.


----------



## SirDice (Dec 15, 2020)

This is a 5 year old thread. The PR refers to now out of date versions.


----------

