UFS Read only filesystem

I was trying to edit some files on a disk yesterday and found the filesystem was read only and wasn't sure why, but eventually checked /etc/fstab which had the partition marked as ro, so I changed this to rw and rebooted expecting to be able to edit files,.... but, the partition was still ro.
Can anyone explain how/where this is set? I'm assuming it has to be somewhere such as loader.conf but can't find where.
 
You don't need to reboot, just mount -a and it should pick up any changes from /etc/fstab. Which filesystem is read-only? The root filesystem perhaps? If that's the case, did you enable a security level?
 
I can't change /etc/fstab because it's on a ro filesystem. The only way I could do it was by mounting that partition when booting from a different partition. The partition in question is basically one with a FreeBSD memstick image on. I'm trying to figure out how it can be ro if I've changed /etc/fstab to make it rw.
 
I can't change /etc/fstab because it's on a ro filesystem.
So it's the root filesystem that's read-only. Filesystem might be corrupt? Security level?

When you boot the root filesystem is always mounted read-only first (that's why it's read-only in single user mode). When the first /etc/rc.d/fsck is finished, before the system goes to multi-user mode the filesystem is remounted according to the settings in /etc/fstab.
 
I've just found that when I reboot after having changed the file, then /etc/fstab has its original contents and my changes do not exist, as though the original file is copied to /etc/fstab from somewhere...
 
Strange situation here which I can't fully explain.... I have two disks with almost identical partitions, ada0p2 and da0p2 and it looks like when I select da0 from the BIOS selection menu, I'm actually booting ada0.

mount shows:-

/dev/ufs/FreeBSD_Install on / (ufs, local, noatime, read-only)

This is the label for ada0p2 which would explain why I'm not getting the /etc/fstab I thought I was.
So, how can I confirm which partition I have booted from?
 
balanga said:
how can I confirm which partition I have booted from?

See /var/log/messages. After reporting all detected hardware it will show something like this:
Apr 26 20:41:28 garfield kernel: Trying to mount root from ufs:/dev/ada1p2 [rw]...
 
I have two disks with almost identical partitions, ada0p2 and da0p2 and it looks like when I select da0 from the BIOS selection menu, I'm actually booting ada0.
Mount that da0 disk and look at the /boot/loader.conf on it. Is there a currdev, rootdev or vfs.root.mountfrom defined that's pointing to the wrong disk?
 
See /var/log/messages. After reporting all detected hardware it will show something like this:
Apr 26 20:41:28 garfield kernel: Trying to mount root from ufs:/dev/ada1p2 [rw]...
but that does not mean the kernel was loaded from the same disk/part
i dont think you can easily tell from where the kernel was booted
 
See /var/log/messages. After reporting all detected hardware it will show something like this:
Apr 26 20:41:28 garfield kernel: Trying to mount root from ufs:/dev/ada1p2 [rw]...
I get:-
mountroot: waiting for device /dev/ufs/FreeBSD_Install...

...which doesn't really tell me which device I'm booting from.
 
Come to think of it, you won't find much in /var/log/messages if it's mounted read-only. But you can see the same stuff on the console. At the first login prompt, press Scroll-Lock and then PgUp, PgUp to see. You can have more than one of these 'mountroot: waiting for..' lines, the last one before the file system checks is what you are looking for.
 
… The partition in question is basically one with a FreeBSD memstick image …

How can I view the content of this type of ⋯.img file?

1622313001984.png
 
Back
Top