Contribute
Register

Script to Backup EFI volume - EFI Mounter

Status
Not open for further replies.
Joined
Nov 29, 2016
Messages
82
Motherboard
Gigabyte GA-Z170X Gaming 7
CPU
Skylake i7 6700K 4.00 GHZ Unlocked
Graphics
Gigabyte GeForce GTX 970 Overclocked GDDR5 4 GB
Mac
  1. MacBook
  2. Mac Pro
Mobile Phone
  1. iOS
For those that are interested i created a simple script that allows you to quickly identify and map your primary drive EFI volume. I am using this in conjunction with Chronosync to schedule regular backups of my EFI volume to another drive in case of primary drive failure.

Chronosync lets you execute a pre-script and a post-script. Those are the scripts i have attached.

But you should be a be able to adapt these to your own use.

efimount.sh - This uses various command line tools to identify the correct boot volume and mount that volumes EFI partition.

If anyone has ever used the EFI Mounter application, where it will ask you to select from a list of partition names. Like disk0s1, disk1s1, disk2s1 etc. What the script is doing is automatically identifying the right partition. I also added an application that people could use to replace EFI Mounter with, to take the guess work out of which one to select.

efimount.sh then uses diskutil to mount the EFI partition.

From that point you can use Chronosync, rsync or any tool to backup your EFI portion to another drive.

The last script efiunmount.sh simply unmounts the EFI partition.

both efimount.sh and efiunmount.sh will need to have the write permissions to be able to run. To do this you need to issue the following command -
chmod 755 efimount.sh
chmod 755 efiunmount.sh

Once done you can execute with command -
./efimount.sh

UPDATE - created an Easy EFI Mounter Application for folks. Rather than having to find out what your mounted disk is to select the right one in EFI Mounter, this application automatically determines the volume you are booted to and mounts that volume's EFI partition.
 

Attachments

  • efiMount.zip
    1.2 KB · Views: 249
  • EasyEFIMounter.app.zip
    1.6 MB · Views: 247
Last edited:
For those that are interested i created a simple script that allows you to quickly identify and map your primary drive EFI volume. I am using this in conjunction with Chronosync to schedule regular backups of my EFI volume to another drive in case of primary drive failure.

Chronosync lets you execute a pre-script and a post-script. Those are the scripts i have attached.

But you should be a be able to adapt these to your own use.

efimount.sh - This uses various command line tools to identify the correct boot volume and mount that volumes EFI partition.

If anyone has ever used the EFI Mounter application, where it will ask you to select from a list of partition names. Like disk0s1, disk1s1, disk2s1 etc. What the script is doing is automatically identifying the right partition. I also added an application that people could use to replace EFI Mounter with, to take the guess work out of which one to select.

efimount.sh then uses diskutil to mount the EFI partition.

From that point you can use Chronosync, rsync or any tool to backup your EFI portion to another drive.

The last script efiunmount.sh simply unmounts the EFI partition.

both efimount.sh and efiunmount.sh will need to have the write permissions to be able to run. To do this you need to issue the following command -
chmod 755 efimount.sh
chmod 755 efiunmount.sh

Once done you can execute with command -
./efimount.sh

UPDATE - created an Easy EFI Mounter Application for folks. Rather than having to find out what your mounted disk is to select the right one in EFI Mounter, this application automatically determines the volume you are booted to and mounts that volume's EFI partition.

Hello jyanes83 -

I'm using CCC for my backups, and was intrigued to discover these scripts, for some reason however, the efimount.sh script never discovers the EFI partition on my High Sierra boot volume, and simply reports that High Sierra is mounted.

I know it's been a while since you posted these scripts, and wondering if something has changed in the Hackintosh world that would prevent the script from working correctly, and perhaps if you had an update to the script.

Regards!
 
Hello, thanks for writing. I had forgotten about posting these. yes with the introduction of high sierra and apfs, the scripts had to be changed a bit to work again. Here are the latest versions
 

Attachments

  • Archive.zip
    1.3 KB · Views: 146
This is likely to be a dumb question but why would you want to regularly (hence the automation need) backup your EFI volume? I was under the assumption that it doesn't change once your hackintosh is setup? Am I missing something? :)

Your right you really should not be changing often. For me it’s an easy way to make sure I am backing up regularly instead of having to remember. I am sure we have all had those times where we forgot to backup and made changes we need to revert.

I believe carbon copy will include the entire drive and efi as part of the clone process. For me I had aleady paid for chronosync and did not want to spend more.

Thanks for the comment
 
I had not seen this thread before, and last month created my own script for doing basically the same thing.

This script is an add-on for CCC or SuperDuper! that will run after the clone job from either of those utilities to automatically clone the EFI partition associated with the source drive to the EFI partition on the destination drive in a single step that is integrated into the clone job in either utility.

I also just added a script that can be set up as a launch daemon to automatically keep a separate copy of the EFI partition with each boot so that if you tweak something and suddenly end up with an unbeatable system - between times you had done a clone of your drive - you should have a very easy path to recovery.

As info, CCC does not automatically clone the EFI partition on a disk when you clone the macOS partition on that same disk. That is what my script does - to extend the functionality of CCC or SD!

Here's the thread that I created...

https://www.tonymacx86.com/threads/eficlone-automatic-backup-of-the-efi-partition.246540/
 
Status
Not open for further replies.
Back
Top