So, what are folks doing these days to mirror /efi and /boot?
I don't think the answer, on Debian, has changed since I asked the
same question in 2020:
https://lists.debian.org/debian-user/2020/11/msg00455.html
Hi,
Le 19/09/2024, Andy Smith <andy@strugglers.net> a ?crit:
I don't think the answer, on Debian, has changed since I asked the
same question in 2020:
https://lists.debian.org/debian-user/2020/11/msg00455.html
There is a script at [1] to install as, e.g., /etc/grub.d/90_copy_to_boot_efi2, so that it is automatically run every
time grub updates its configuration file. I believe the script is fine, except I would do
mount /boot/efi2
rather than
mount /boot/efi2 || :
Maybe the intent is for the script not to return a non-zero exit status
when /boot/efi2 can't be mounted, however in this case I certainly don't
want the rsync command to be run.
Haven't looked at the script but assuming it's run set -e, then your suggestion will fail if it's already mounted.
Le 20/09/2024, Tim Woodall <debianuser@woodall.me.uk> a ?crit:
Haven't looked at the script but assuming it's run set -e, then your
suggestion will fail if it's already mounted.
Why?
Because the script will abort after the mount fails.
root@dirac:~# cat test.sh
#!/bin/bash
set -e
mount /boot/efi2
echo "do important stuff"
root@dirac:~# ./test.sh
mount: /boot/efi2: /dev/sda2 already mounted on /boot/efi2.
dmesg(1) may have more information after failed mount system call.
Note that do important stuff is never reached.
Le 20/09/2024, Tim Woodall <debianuser@woodall.me.uk> a écrit:
Because the script will abort after the mount fails.
root@dirac:~# cat test.sh
#!/bin/bash
set -e
mount /boot/efi2
echo "do important stuff"
root@dirac:~# ./test.sh
mount: /boot/efi2: /dev/sda2 already mounted on /boot/efi2.
dmesg(1) may have more information after failed mount system call.
Note that do important stuff is never reached.
That's interesting because my system doesn't behave the same. I had of
course checked, before writing my first message, that 'mount /boot/efi2' returns exit status 0 even when /boot/efi2 is already mounted. With your script (called foo.sh here), here is what I get:
# mount | grep efi2
/dev/sda1 on /boot/efi2 type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro)
# /tmp/foo.sh
do important stuff
# mount | grep efi2
/dev/sda1 on /boot/efi2 type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro)
/dev/sda1 on /boot/efi2 type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro)
#
Every invocation adds a new, duplicate entry in the output of 'mount'.
This is Debian sid amd64; /usr/bin/mount is from 'mount' package version 2.40.2-8.
-- If I have multiple drives, do I modify the script to have multiple
efi2, efi3, ..., efiX ?
-- it seems that the script above privileges /boot/efi over /boot/efi2
-- in this case, if /boot/efi becomes corrupted, won't this just copy
the errors to /boot/efi2 and thus destroy it as well, on the next run?
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 546 |
Nodes: | 16 (0 / 16) |
Uptime: | 156:07:26 |
Calls: | 10,384 |
Calls today: | 1 |
Files: | 14,056 |
Messages: | 6,416,468 |