Contribute
Register

EFIClone - automatic backup of the EFI partition

Looking at the script in Xcode I see the script should un-mount the EFI partition on successful completion - so am thinking the script has not completed successfully

EDITED to add
First of all I am no expert or anything close on scripts but it occurred to me that the EFICurrent folder was not being created - so I manually created the folder within the EFISystemRestore folder and then rebooted.
After reading the log the script ran all the way through and the EFI partition was unmounted.
On checking the EFICurrent folder it contained a backup of EFI and within the EFISystemRestore folder was the .tar.bz archive.
 

Attachments

  • Archive.zip
    64.2 KB · Views: 172
Last edited:
@wombat94 Many thanks for both these scripts - the first one used with CCC works perfectly for me but I appear to have an issue with EFISystemRestore.

I installed it as per the instructions and then re-booted
The first thing I noticed was that after boot my EFI partition was mounted
I then checked and could find no backup of the EFI partition
I read the log from the EFISystemRestore folder (which I am attaching) and noticed there was no successful completion line at the end which I sort of expected.
I thought maybe something had gone wrong when I went through the instructions so I issued these commands again in

sudo launchctl load -w /Library/LaunchDaemons/com.hackintosh.EFISystemRestoreBackup.plist
sudo chown root /Library/LaunchDaemons/com.hackintosh.EFISystemRestoreBackup.plist
I then re-booted again and had the same result - no sign of a backup

what do you think?

I'll take a look at the log tonight and let you know. As far as I am aware you are the first person (other than me) to give that script a try... there may be some additional steps necessary for correct installation/config that I didn't capture since I am running on the same machine I developed it on - probably permission related.

Thanks for trying it out - we'll figure out why it isn't working.

Ted
 
Looking at the script in Xcode I see the script should un-mount the EFI partition on successful completion - so am thinking the script has not completed successfully

EDITED to add
First of all I am no expert or anything close on scripts but it occurred to me that the EFICurrent folder was not being created - so I manually created the folder within the EFISystemRestore folder and then rebooted.
After reading the log the script ran all the way through and the EFI partition was unmounted.
On checking the EFICurrent folder it contained a backup of EFI and within the EFISystemRestore folder was the .tar.bz archive.

Ahh... very good call. I will create an issue and update the script tonight to create the EFICurrent folder if it does not exist.

Exactly the kind of error that I was thinking of in my previous post - something I missed on the dev machine.

Glad it is working for you.
 
Hi, I would like to try this. Currently I have bought CCC but haven't done a backup yet. I was just wondering what is the best method to take. Should I follow this advice I've found from another post? Sorry I'm not too sure what order to do things for the backup process. I believe your script does its thing after the backup? However since I've not make one yet or even formatted the backup drive, not quite sure best steps.
- The first step is install Clover on the "new" drive, ie, the new empty, unformatted clone drive. When you do that, make sure you have set it up to be a UEFI bootable drive. If you don't know how to do that, check one of the many guides here which will show you how to do that.

- Next Expose the EFI partition on the current working boot drive that you are currently booting with (with EFI Mounter (available on this site) or any other utility - there are many that can do this, and there is also a way to do this via the command line), and copy the EFI directory. I put it on the desktop. Then I dismount the EFI partition. Just right click on the drive and choose "Eject". Sometimes it will ask you to dismount additional drives. If it does, don't do it. This step is a convenience and is not required. Just dismount the EFI partition only, nothing else.

- Next, expose the EFI partition on "clone" drive, the drive you have just installed Clover on. Be careful not to confuse the two EFI partitions. If you were able to eject the first EFI partition on the existing current drive, this should be easy, as you should only have one exposed EFI partition to work with. But if you have two, it is very important to keep track of which one is which.

- On your new "clone" drive, on the EFI partition there, you should have an EFI directory. It should be mostly empty, with not a lot of files and Kexts on it. What I do is delete that EFI directory and copy the EFI directory that is on my desktop and put it right on the "clone" EFI partition. Essentially, you are replacing the EFI directory on the "clone" drive with the EFI directory from your current, working boot drive.

- Then, and only then, do I run Carbon Copy Cloner, cloning from the working boot drive to the new "clone" drive.

- When it's done, I test the new "clone" drive and boot to it to make sure I know it's bootable, and working.
 
Hi, I would like to try this. Currently I have bought CCC but haven't done a backup yet. I was just wondering what is the best method to take. Should I follow this advice I've found from another post? Sorry I'm not too sure what order to do things for the backup process. I believe your script does its thing after the backup? However since I've not make one yet or even formatted the backup drive, not quite sure best steps.

My script - when used as the post-clone script in CCC - is designed to automate exactly those steps that are outlined in the post that you quoted.

What the EFIClone script does is mount the EFI partitions from both the source and destination drives at the same time - taking a lot of care to ensure that it knows which is which - and then copies the contents of the source drive's EFI partition to the destination drive's EFI partition.

There is no need to do those steps manually at all - as long as the destination drive is partitioned with a GPT partition structure instead of MBR, then the EFIClone script attached to a clone all files CCC job should create a bootable backup to a new drive in one step.

By all means, I recommend testing the results by trying to boot to the new drive after the job is complete, but you should not need to do anything else to make it work.

Give it a try, and please report back if it does not work for you.

Ted
 
My script - when used as the post-clone script in CCC - is designed to automate exactly those steps that are outlined in the post that you quoted.

What the EFIClone script does is mount the EFI partitions from both the source and destination drives at the same time - taking a lot of care to ensure that it knows which is which - and then copies the contents of the source drive's EFI partition to the destination drive's EFI partition.

There is no need to do those steps manually at all - as long as the destination drive is partitioned with a GPT partition structure instead of MBR, then the EFIClone script attached to a clone all files CCC job should create a bootable backup to a new drive in one step.

By all means, I recommend testing the results by trying to boot to the new drive after the job is complete, but you should not need to do anything else to make it work.

Give it a try, and please report back if it does not work for you.

Ted
Great thanks for the advice, I will try it out and report. Should I format my destination hard disk to be cloned / the backup with just one single partition, as GPT? is it best to use apple disk utility or format it from CCC?
 
Great thanks for the advice, I will try it out and report. Should I format my destination hard disk to be cloned / the backup with just one single partition, as GPT? is it best to use apple disk utility or format it from CCC?

You only need one "visible" partition as you format it with macOS Disk Utility... the EFI partition is a part of the GPT partitioning scheme and it will be created automatically. The macOS GUI tools do not generally show it to you, but it will be there. You can confirm its presence by opening a terminal session and issuing the command: diskutil list

That will show all of your physical disks that are connected and all of the partitions that are on those disks, whether they are mounted or not.
 
One question for wombat94. Do those that are using APFS on their High Sierra SSD need to pre-format their backup SSD drive (not platter disks) APFS in Disk utility? Does CCC take care of that step for us or notify that we need to do that ? I've always backed up to a mechanical, platter disk and not to SSD drives.
 
One question for wombat94. Do those that are using APFS on their High Sierra SSD need to pre-format their backup SSD drive (not platter disks) APFS in Disk utility? Does CCC take care of that step for us or notify that we need to do that ? I've always backed up to a mechanical, platter disk and not to SSD drives.

I can't say for certain as I have not performed this scenario either. I have not used APFS with CCC or my clone script myself yet. From what I know of what goes on with APFS, though, it does NOT appear to affect the EFI partition at all. The EFI partition and any other non-apple partitions (my BootCamp partition on my MacBook Pro - which is SSD) for instance. Those partitions are mountable and unencrypted.

If CCC will format the destination disk properly in its process I don't see any reason you CAN'T use it including adding my EFIClone script, but I have always done the disk formatting myself.
 
FWIW, I added a couple of variables to EFIClone.sh to reflect the machine name and date. I have several hack/macs and I wanted to keep all the logs in one folder location without stepping on each other. So, I added a couple of variables to EFIClone.sh to reflect the machine name and date and updated the log file name to use them.

Mname=`hostname -s`
Tnow=`date +"%m-%d-%y_%H-%M-%S"`
LOG_FILE="$PWD/${Mname}.${Tnow}.EFIClone.log"
 
Back
Top