Re: Trying do mount a slice containing a mounted partition makes the filesystem unreadable
Hello Helge, and thank you for replying again. On Sat, Feb 27, 2021 at 03:43:52PM +0100, Helge Oldach wrote: > Arrigo Marchiori via freebsd-stable wrote on Sat, 27 Feb 2021 14:00:24 +0100 > (CET): > > On the memstick, the root filesystem is mounted read-only. I > > apologize, I should have told it explicitly. The ``invalid'' attempt > > is to mount it read-write (no mode is indicated on the command line). > > Try to make it r/w mounted (which I suspect you are attempting to > achieve): > > mount -uw / Ok, I will try this. But just for the record: I am not try to achieve anything. I gave the ``invalid'' mount command by mistake (I wanted to mount a partition from another disk and wrote "da0" instead of "da1") and I saw that the system became unstable. I thought that this should not happen and I reported it here. Best regards, -- Arrigo http://rigo.altervista.org ___ [email protected] mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "[email protected]"
Re: Trying do mount a slice containing a mounted partition makes the filesystem unreadable
Hello Helge, Kevin, and thank you for replying. On Sat, Feb 27, 2021 at 09:21:39AM +0100, Helge Oldach wrote: > Kevin P. Neal wrote on Sat, 27 Feb 2021 03:04:35 +0100 (CET): > > On Fri, Feb 26, 2021 at 06:25:05PM +0100, Helge Oldach wrote: > > > Arrigo Marchiori via freebsd-stable wrote on Fri, 26 Feb 2021 17:02:35 > > > +0100 (CET): > > > > Description: when a BSD partition is mounted to / (suppose > > > > /dev/da0s2a), if I try to mount its containing slice (/dev/da0s2) I > > > > receive a ``strange'' error message, and from that moment the mounted > > > > filesystem becomes unreadable. > > > > > > Actually you are mounting the same location on disk twice under > > > different file systems which is a bad idea. > > > > > > For example: > > > > > > # gpart show -p ada0s2 > > > =>0 250064341 ada0s2 BSD (119G) > > > 0 241172480 ada0s2a freebsd-ufs (115G) > > > 2411724808891861 ada0s2b freebsd-swap (4.2G) > > > > > > Note the "0" offset for both ada0s2 and ada0s2a. When you mount, both > > > "look" like a proper, distinct UFS but actually it's the same location > > > on disk so UFS will get confused if you have both mounted rw. It should > > > go well however if only one is mounted rw and the other(s) ro. I believe that the memstick images may not organized as you pointed out. The standard behavior of mkimg(1) is to leave a small gap between the beginning of the slice and the beginning of the first partition. But I will be able to confirm on Monday, when I will be back to the office. > > Wait, really? It seems like the ro mount wouldn't see any blocks (or other > > unit of data) cached by the rw mount. So the ro mount would see an > > inconsistent filesystem and I personally would expect a crash or other > > misbehavior. > > Of course the ro "view" will show inconistencies. That's actually what > one asks for if doing such bad things as mounting volumes twice. However > it shouldn't crash as the rw mount of / maintains consistency. On the memstick, the root filesystem is mounted read-only. I apologize, I should have told it explicitly. The ``invalid'' attempt is to mount it read-write (no mode is indicated on the command line). I did not try the mount command in read-only mode. I can try this on Monday as well. IMHO it is important to note that everything works as expected when the partition is mounted from /dev/ufs/label: the mount attempt is not permitted and nothing else happens. Even if mounting an already-mounted partition is an invalid action, I do not think that it should render a system unstable. I understand that ``the root user should be allowed to do anything'', even shoot themselves in the foot. But on the other hand, there are features such as kern.geom.debugflags that explicitly avoid it. I hope I could explain myself clearly. Best regards, -- Arrigo http://rigo.altervista.org ___ [email protected] mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "[email protected]"
Trying do mount a slice containing a mounted partition makes the filesystem unreadable
Dear All, I think I found a bug that is similar to an already reported one, but I am not sure. Description: when a BSD partition is mounted to / (suppose /dev/da0s2a), if I try to mount its containing slice (/dev/da0s2) I receive a ``strange'' error message, and from that moment the mounted filesystem becomes unreadable. This problem appears: - on a memstick built from 11.4-STABLE r369279, - on the ``official'' 12.2-RELEASE memstick, both tested on amd64. Fun fact: the problem does _not_ appear if the already-mounted filesystem is mounted from /dev/ufs/label instead of /dev/da0s2a. Steps to reproduce on 12.2-RELEASE == 1- download the official memstick image for 12.2-RELEASE-amd64 and flash it into a USB pen drive 2- edit /boot/loader.conf on the memstick adding the following lines (needed to boot successfully on my test system): kern.vty=sc kern.cam.boot_delay=1 kern.cam.scsi_delay=1 3- edit /etc/fstab on the memstick and change the root device from /dev/ufs/FreeBSD_Install to /dev/da0s2a 4- boot the memstick and open a shell 5- # mount /dev/da0s2 /mnt mount: /dev/da0s2: No such file or directory <--- strange message! 6- the filesystem is now unreadable! For example, trying to run some binaries not yet in the cache: # man /usr/bin/man: Device not configured If I try to reboot, the console is flooded by: > vm_fault: pager read error, pid 1 (init) This problem also appears on a memstick built from 11.4-STABLE r369279. The error messages are different, but the outcome is the same. Expected behavior = If the root partition is mounted from /dev/ufs/label (i.e. you skip step 3 above) the culprit mount command (step 5 above) gives the following error message: > mount: /dev/da0s2: Operation not permitted and the system remains healty and stable. Am I seeing PR 222948: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=222948 or is it something else? Thank you in advance and best regards, -- Arrigo http://rigo.altervista.org ___ [email protected] mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to "[email protected]"
