Last active
February 10, 2025 08:59
-
-
Save thhart/35f6e4e715c70c2cbe7c5846311d1f9f to your computer and use it in GitHub Desktop.
Sample systemd setup to mount efi partitions and sync them in a service on shutdown
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Sync EFI partitions | |
[Service] | |
Type=oneshot | |
ExecStop=/usr/bin/sync-efi | |
[Install] | |
WantedBy=multi-user.target |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#sample efi file to mount efi partitions and sync them in a service on shutdown | |
#UUID are different for each system of course, run blkid to see | |
UUID=EE08-63AC /boot/efi vfat utf8,nofail 0 2 | |
UUID=D6DD-B604 /boot/efi2 vfat utf8,nofail 0 2 | |
UUID=D725-1927 /boot/efi3 vfat utf8,nofail 0 2 | |
UUID=D761-CCBA /boot/efi4 vfat utf8,nofail 0 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!/bin/bash | |
# Find all EFI partitions and sync them | |
for partition in $(egrep "boot/efi[0-9]" /etc/fstab | awk '{ print $2 }'); do | |
echo "Syncing EFI partition: $partition" | |
rsync -a --delete /boot/efi $partition | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment