Mailing List Archive

Doubly mounted /boot
Hello list,

My little Celeron LAN server lives on /dev/sda5, with /boot on /dev/sda2. It's
a UEFI system so /dev/sda2 is VFAT. Other partitions exist but they're not
germane here.

The poor wee thing takes about four hours to compile a kernel using both its
cores, during which time I keep /boot mounted. I could leave mounting it until
the 'make install' stage but I haven't done that so far.

The machine also contains a small rescue system on /dev/sda4, which I maintain
in a chroot under /mnt/rescue. Its kernel also takes four hours since I prefer
to keep the two kernels identical (apart from a local '-rescue' suffix in that
system).

Now, my question is: is it safe for me to mount the boot partition on /boot
and /mnt/rescue/boot simultaneously? The man page hints that it is, and I can
see them both:

$ cat /proc/mounts | grep boot
/dev/sda2 /mnt/rescue/boot vfat rw,relatime,fmask=0022,dmask=0022,codepage=850,iocharset=iso8859-1,shortname=mixed,errors=remount-ro 0 0
/dev/sda2 /boot vfat rw,relatime,fmask=0022,dmask=0022,codepage=850,iocharset=iso8859-1,shortname=mixed,errors=remount-ro 0 0

The main system and the rescue system will each write files to its own /boot,
but there shouldn't be any collisions because of course they all have different
names.

Ordinarily, there's no difficulty because the two systems don't usually need
kernels compiled at the same time, but if I can run them concurrently
overnight I ought to finish ahead.

Has anyone any cautionary notes for me?

--
Regards,
Peter.
Re: Doubly mounted /boot [ In reply to ]
On Sat, 15 Jul 2023 03:01:05 +0100, Peter Humphrey wrote:

> Now, my question is: is it safe for me to mount the boot partition on
> /boot and /mnt/rescue/boot simultaneously? The man page hints that it
> is, and I can see them both:
>
> $ cat /proc/mounts | grep boot
> /dev/sda2 /mnt/rescue/boot vfat
> rw,relatime,fmask=0022,dmask=0022,codepage=850,iocharset=iso8859-1,shortname=mixed,errors=remount-ro
> 0 0 /dev/sda2 /boot vfat
> rw,relatime,fmask=0022,dmask=0022,codepage=850,iocharset=iso8859-1,shortname=mixed,errors=remount-ro
> 0 0

It looks OK, but it might be cleaner to use a bind mount

mount --bind /boot /mnt/rescue/boot


--
Neil Bothwick

Don't forget that MS-Windows is just a temporary workaround until you can
switch to a GNU system.
Doubly mounted /boot [ In reply to ]
I don't know if vfat is safe to be mounted twice, but to solve this I'd go with mount bind. You can use it in /etc/fstab as well. Mount the /boot as usual, for /mnt/rescue/boot use /boot as a source and add "bind" to options section. This is definitely safer
Re: Doubly mounted /boot [ In reply to ]
Peter Humphrey wrote:
> Hello list,
>
> My little Celeron LAN server lives on /dev/sda5, with /boot on /dev/sda2. It's
> a UEFI system so /dev/sda2 is VFAT. Other partitions exist but they're not
> germane here.
>
> The poor wee thing takes about four hours to compile a kernel using both its
> cores, during which time I keep /boot mounted. I could leave mounting it until
> the 'make install' stage but I haven't done that so far.
>
> The machine also contains a small rescue system on /dev/sda4, which I maintain
> in a chroot under /mnt/rescue. Its kernel also takes four hours since I prefer
> to keep the two kernels identical (apart from a local '-rescue' suffix in that
> system).
>
> Now, my question is: is it safe for me to mount the boot partition on /boot
> and /mnt/rescue/boot simultaneously? The man page hints that it is, and I can
> see them both:
>
> $ cat /proc/mounts | grep boot
> /dev/sda2 /mnt/rescue/boot vfat rw,relatime,fmask=0022,dmask=0022,codepage=850,iocharset=iso8859-1,shortname=mixed,errors=remount-ro 0 0
> /dev/sda2 /boot vfat rw,relatime,fmask=0022,dmask=0022,codepage=850,iocharset=iso8859-1,shortname=mixed,errors=remount-ro 0 0
>
> The main system and the rescue system will each write files to its own /boot,
> but there shouldn't be any collisions because of course they all have different
> names.
>
> Ordinarily, there's no difficulty because the two systems don't usually need
> kernels compiled at the same time, but if I can run them concurrently
> overnight I ought to finish ahead.
>
> Has anyone any cautionary notes for me?
>


I tend to agree with the others.  It is likely safe but bind mounting
may be safer. 

The one thing you want to always avoid, mounting two file systems to the
same place.  If I recall correctly, whatever you mount last is what the
system actually sees.  The other is hidden underneath.  Look at it like
two sheets of paper.  You lay down one with writing on it then put a
second sheet of paper with writing on it on top of the first sheet.  The
first sheet is there but I don't think the system can actually write to
it or even read it.  The second sheet is covering up the first sheet. 
Once you unmount whatever you mounted last, it shows up again.

I actually done that once ages ago by accident.  The results of mount
and ls was weird to say the least.  I was expecting one thing but got
something different.  I can't recall how I managed to do that tho.  That
was a long time ago so I think I got it right. 

Dale

:-)  :-) 
Re: Doubly mounted /boot [ In reply to ]
On Saturday, 15 July 2023 09:42:55 BST Dale wrote:

> I tend to agree with the others. It is likely safe but bind mounting
> may be safer.

Thanks all. I'm glad I asked. :)

--
Regards,
Peter.
Re: Doubly mounted /boot [ In reply to ]
On Sat, 15 Jul 2023 11:46:58 +0400 (GMT+04:00), Sergey Filatov wrote:

> I don't know if vfat is safe to be mounted twice, but to solve this I'd
> go with mount bind. You can use it in /etc/fstab as well. Mount the
> /boot as usual, for /mnt/rescue/boot use /boot as a source and add
> "bind" to options section. This is definitely safer

Just make sure you mount /boot first, otherwise /mnt/rescue/boot will
bind to the empty boot directory on /.


--
Neil Bothwick

Politicians are like nappies
Both should be changed regularly, and for the same reason