Git Product home page Git Product logo

eficlone's Introduction

EFIClone

EFIClone.sh is a macOS bash shell script for Hackintosh machines that is designed to integrate with either Carbon Copy Cloner or SuperDuper! - the two most popular macOS disk cloning utilities.

CCC and SD! both will automatically create bootable clones on real Macintoshes in a single step. Though modern Macs support the EFI booting in order to maintain compatibility with running non-Apple operating system on their hardware, they do NOT need the EFI partition in order to boot MacOS. Because of this, the disk clone utilities do not copy the contents of the secondary EFI partition from one drive to another when doing their job.

This is where EFIClone comes in.

Both CCC and SD! have the ability to configure a "post flight" script that will be launched when the main clone job has been completed.

Both programs pass details of the source and destination drives that were used in the clone job, and from this the script is able to find the associated EFI partitions and automatically copy the contents of the critical EFI folder from the source drive to the destination drive as well.

The script provides extensive logging, has a "test" mode that will log what it WOULD have done but will not modify any data, and sends a notification to the macOS notification center with the results of the run.

When configured in your CCC or SD! clone job, EFIClone will allow you to do a single-step clone from your current hackintosh drive to a truly bootable backup drive with no other steps required.


SCRIPT CONFIGURATION

There are currently only two user confiruation settings.

Since this is a script file, they have to be manually edited with a text editor.

The most important setting is the TEST_SWITCH.

TEST_SWITCH="Y" (Default on a new install is "Y")

  • a value of "Y" tells the script to only test it's run - no modification of data will happen
  • a value other than "Y" allows the script to run in normal mode - it will delete the contents of the destination EFI partition and replace them with the contents of the source EFI partition.

This setting tells the script whether to run in Test Mode. In Test Mode all parsing of the script input will take place, the EFI partitions will be mounted, the data on the source and destination partitions will be verified and all activity will be logged, but NO DATA WILL BE MODIFIED. This is a safety measure. Please run the script with TEST_SWITCH="Y" at least once and review the log file to see the results before attemtping to let the script modify anything. I use this script for myself and have no problems with it but is is brand new (beta) and it WILL delete the contents of what it believe is the EFI partiton on the destination drive. It is possible that something could be screwed up and I don't want to delete the wrong data. Regardless of what the test shows, I have to add this disclaimer: I AM NOT RESPONSIBLE FOR DATA LOSS ON YOUR SYSTEM. PLEASE ENSURE YOU HAVE A WORKING BACKUP BEFORE YOU ATTEMPT TO USE THIS SCRIPT. I HAVE DONE EVERYTHING I CAN TO PREVENT DATA LOSS, BUT THERE MAY BE BUGS IN THIS CODE. I PROVIDE NO WARRANTY ON THE SOFTWARE. USE AT YOUR OWN RISK.

The only other setting is the path where the log file will be written out.

LOG_FILE="$PWD/EFIClone.log" (Default is the path to the working directory and a file named EFIClone.log)

There is no absolute need to change this setting, but if you want to force the log to be written elsewhere, you can put the full path in this setting.

From what I can tell, both Carbon Copy Cloner and SuperDuper! run the script with a woking directory of the root of the boot drive "/". That is where it writes the log on my system every time. If you can't find the log, just search for it in SpotLight.

INSTALLATION

There really is nothing to "install". This is a simple shell script that relies ONLY on native macOS command line utilities to perform all of its functions.

Download the file and place it anywhere on your system that is accessible.

CLONE UTILITY CONFIGURATION

The configuration of both utilities is similar, but not exact. See the following sections for each.

Carbon Copy Cloner

  1. Create a Clone task as you normally would, defining the Source and Destination partitions.
  2. Click on the Advance Settings button, just below the Source partition.
  3. The advanced settings pane will open. If necessary scroll down until you can see the section labeled "AFTER COPYING FILES" and click on the folder icon next to "Run a Shell Script:"
  4. Use the file dialog to select EFIClone.sh from the folder where you placed it after downloading.
  5. After you have selected it, your task should look like this - with the script name "EFIClone.sh" showing next to the "Run a Shell Script:" line. If you want to you can click on the "eye" icon to see a read-only version of the script. If you need to change the script (or remove it completely) you can click on the "X" icon to deatch the script from your CCC Task.

SuperDuper!

  1. Choose your Source and Destination partitions in the "Copy" and " to " drop down menus.
  2. Click on the "Options..." button
  3. This will display the "General" options tab. Click on "Advanced" to show the Advanced options.
  4. Check the box that says "Run shell script after copy completes" and click on "Choose..."
  5. Use the file dialog to select EFIClone.sh from the folder where you placed it after downloading.
  6. After you have selected it, the dialog should show the path to the script.

Please report any bugs. Feel free to open issues for enhancements you would like to see.

eficlone's People

Contributors

wombat94 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

eficlone's Issues

Include all visible files in the EFI partition

Previous code only copied the /EFI/ directory (and subdirectories) from the source to the destination.

Change to include all visible files, directories and subdirectories in the entire partition in the copy.

Script doesn't seem to work with CCC 5.1.8-b2 on Mojave

I can't get EFIClone.sh to run successfully with the latest beta of CCC (v5.1.8-b2). The log reports this:

[Sun Jan 20 07:32:41 MST 2019] - ***** EFI Clone Script start
[Sun Jan 20 07:32:41 MST 2019] - working directory = /
[Sun Jan 20 07:32:41 MST 2019] - Running /Library/Application Support/com. bombich.ccc/Scripts/EFIClone.sh
[Sun Jan 20 07:32:41 MST 2019] - Called From Carbon Copy Cloner
[Sun Jan 20 07:32:41 MST 2019] - 1: Source Path = /private/tmp/16777223@ 190120073240
[Sun Jan 20 07:32:41 MST 2019] - 2: Destination Path = /Volumes/Tim's CCC Backup
[Sun Jan 20 07:32:41 MST 2019] - 3: CCC Exit Status =
[Sun Jan 20 07:32:41 MST 2019] - 4: Disk image file path =
[Sun Jan 20 07:32:41 MST 2019] - CCC did not exit with success, the EFI Clone Script will not run

So it appears that the script is expecting call parameters different than what CCC is sending. I'm not sure if this is a change in CCC's behavior or what.

Refactor physical disk detection routines

Rewrite the physical volume detection routines to simplify code and make it more efficient.

Pseudo-code:

Check if disk is a physical volume. If it is no further work at this point.

If not, check if core storage or APFS and find physical disk where virtual disk resides in appropriate manner.

After above, THEN search for EFI partition once.

Script detects multiple boot EFI partitions and hangs

Hey, thanks for the excellent script.

I noticed an issue when I have one of my backup drives connected (it isn't always connected). The script detects 2 sourceEFIPartition (disk1s1 and disk11s1 in my case). The script sat for 20+ minutes at "building file list" before I killed it.

Strangely, Clover Configurator also shows "Current Boot Disk" next to both disk1s1 and disk11s1 - not really sure how this is possible. disk1 is physically an SSD internal to the computer, and disk11 is an external drive.

I will try with the external removed to make sure it works, but in the meantime any help you can give would be appreciated. Thanks.

/dev/disk1 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *120.0 GB   disk1
   1:                        EFI EFI                     209.7 MB   disk1s1
   2:                  Apple_HFS Mac HD                  119.2 GB   disk1s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk1s3

...

/dev/disk11 (external, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *10.0 TB    disk11
   1:                        EFI EFI                     209.7 MB   disk11s1
   2:          Apple_CoreStorage Offsite Mac Backups     10.0 TB    disk11s2
   3:                 Apple_Boot Boot OS X               134.2 MB   disk11s3
[Sun Apr 17 14:23:00 AEST 2022] - ***** EFI Clone Script start
[Sun Apr 17 14:23:00 AEST 2022] - working directory = /
[Sun Apr 17 14:23:00 AEST 2022] - Running /Applications/Tools/EFIClone-master/EFIClone.sh
[Sun Apr 17 14:23:00 AEST 2022] - Called From Carbon Copy Cloner
[Sun Apr 17 14:23:00 AEST 2022] - 1: Source Path = /
[Sun Apr 17 14:23:00 AEST 2022] - 2: Destination Path = /Volumes/BOOTABLE Hackintosh 1
[Sun Apr 17 14:23:00 AEST 2022] - 3: CCC Exit Status = 0
[Sun Apr 17 14:23:00 AEST 2022] - 4: Disk image file path = 
[Sun Apr 17 14:23:00 AEST 2022] - CCC completed with success, the EFI Clone Script will run
[Sun Apr 17 14:23:00 AEST 2022] - CCC clone was not to a disk image. the EFI Clone Script will run
[Sun Apr 17 14:23:00 AEST 2022] - sourceVolume = /
[Sun Apr 17 14:23:00 AEST 2022] - sourceVolumeDisk = disk1
[Sun Apr 17 14:23:00 AEST 2022] - destinationVolume = /Volumes/BOOTABLE Hackintosh 1
[Sun Apr 17 14:23:00 AEST 2022] - destinationVolumeDisk = disk9
[Sun Apr 17 14:23:01 AEST 2022] - sourceEFIPartition = disk1s1 disk11s1
[Sun Apr 17 14:23:01 AEST 2022] - destinationEFIPartition = disk9s1
[Sun Apr 17 14:23:01 AEST 2022] - efiBootPartitionUUID = 
[Sun Apr 17 14:23:01 AEST 2022] - efiBootPartitionDisk = 
[Sun Apr 17 14:23:01 AEST 2022] - drives Mounted
[Sun Apr 17 14:23:01 AEST 2022] - sourceEFIMountPoint =
[Sun Apr 17 14:23:02 AEST 2022] - destinationEFIMountPoint = /Volumes/EFI
[Sun Apr 17 14:23:02 AEST 2022] - ********* Test simulation - file delete/copy would happen here. 
[Sun Apr 17 14:23:02 AEST 2022] - rsync command will be executed with the --dry-run option
[Sun Apr 17 14:23:02 AEST 2022] - rsync command calculated is...
[Sun Apr 17 14:23:02 AEST 2022] - rsync -av --exclude='.*'' / /Volumes/EFI/
[Sun Apr 17 14:23:02 AEST 2022] - THE BELOW OUTPUT IS FROM AN RSYNC DRY RUN! NO DATA HAS BEEN MODIFIED!
building file list ... 

Script does not detect destination EFI partition when destination volume is APFS

Hello
Script exits with the following message:
"Source and Destination EFI Partitions are the same. Script exiting."

Workaround is to reformat destination volume to Mac OS Extended (Journaled).
It's not a big issue as it's a backup.

My config and logs:

Macintosh SSD is source and Macintosh CCC is the backup destination:
/dev/disk0 (internal):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                         256.1 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:                 Apple_APFS Container disk3         255.9 GB   disk0s2

/dev/disk1 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *1.1 TB     disk1
   1:                        EFI EFI                     209.7 MB   disk1s1
   2:                  Apple_HFS Data                    1.0 TB     disk1s2

/dev/disk2 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *256.1 GB   disk2
   1:                        EFI EFI                     209.7 MB   disk2s1
   2:                  Apple_HFS Macintosh CCC           255.1 GB   disk2s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk2s3

/dev/disk3 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +255.9 GB   disk3
                                 Physical Store disk0s2
   1:                APFS Volume Macintosh SSD           145.5 GB   disk3s1
   2:                APFS Volume Preboot                 46.9 MB    disk3s2
   3:                APFS Volume Recovery                510.4 MB   disk3s3
   4:                APFS Volume VM                      2.1 GB     disk3s4

Log file:

[Wed Nov 13 19:36:55 CET 2019] - ***** EFI Clone Script start
[Wed Nov 13 19:36:55 CET 2019] - working directory = /
[Wed Nov 13 19:36:55 CET 2019] - Running /Users/Shared/EFIClone-master/EFIClone.sh
[Wed Nov 13 19:36:55 CET 2019] - Called From Carbon Copy Cloner
[Wed Nov 13 19:36:55 CET 2019] - 1: Source Path = /
[Wed Nov 13 19:36:55 CET 2019] - 2: Destination Path = /Volumes/Macintosh CCC
[Wed Nov 13 19:36:55 CET 2019] - 3: CCC Exit Status = 0
[Wed Nov 13 19:36:55 CET 2019] - 4: Disk image file path = 
[Wed Nov 13 19:36:55 CET 2019] - CCC completed with success, the EFI Clone Script will run
[Wed Nov 13 19:36:55 CET 2019] - CCC clone was not to a disk image. the EFI Clone Script will run
[Wed Nov 13 19:36:55 CET 2019] - sourceVolume = /
[Wed Nov 13 19:36:55 CET 2019] - sourceVolumeDisk = disk3
[Wed Nov 13 19:36:55 CET 2019] - destinationVolume = /Volumes/Macintosh CCC
[Wed Nov 13 19:36:55 CET 2019] - destinationVolumeDisk = disk4
[Wed Nov 13 19:36:55 CET 2019] - sourceEFIPartition = disk2s1
[Wed Nov 13 19:36:56 CET 2019] - destinationEFIPartition = disk2s1
[Wed Nov 13 19:36:56 CET 2019] - efiBootPartitionUUID = 
[Wed Nov 13 19:36:56 CET 2019] - efiBootPartitionDisk = 
[Wed Nov 13 19:36:56 CET 2019] - Source and Destination EFI Partitions are the same. Script exiting.

Excellent script, by the way, makes Hackintosh backup a lot easier !

Error post backup to a Network sparsebundle

A little background, I clone my main ssd drive to a NAS over LAN using SuperDuper! The clone works fine and is mounted as a Volume.

I have EFIClone set to run post completion as stated in the Readme, I checked the logs with TEST_SWITCH="Y" and got the following error below:

EFIClone.log

[Mon Apr  9 13:37:47 EDT 2018] - ***** EFI Clone Script start
[Mon Apr  9 13:37:47 EDT 2018] - working directory = /
[Mon Apr  9 13:37:47 EDT 2018] - Running /Users/install/Downloads/EFIClone-master/EFIClone.sh
[Mon Apr  9 13:37:47 EDT 2018] - 5 parameters were passed in. This is an unsupported number of parameters. Exiting now

Is there anyway to print the params to further debug? Are network drives supported? Is this just an issue with SuperDuper?

Add configuration options to backup the source EFI partition to either a directory or .zip file at a given path on the destination data directory

Add an option the user can configure to copy the contents of the EFI partition to a specific place on the destination - either compressed or in a unique subfolder.

This will allow the script to run without modifying an EFI folder and potentially disrupting a bootable system by incorrectly deleting data in the destination partition and also will allow the user to create an archive of EFI partition contents over time as they change.

Clover needed for bdmesg

It's worth mentioning you need to install Clover to use bdmesg in getCurrentBootEFIVolumeUUID

I used Unibeast + Multibeast + Clover Configurator on my install and bdmesg is not on my machine.

Unsupported number of parameters with SuperDuper!

Setup

  • SuperDuper 3.3.1
  • EFIClone b10403d
  • macOS 10.15.7

Steps to reproduce:

  • Run SuperDuper as described in README setting EFIClone.sh as "After Copy" script

Expected behaviour

  • EFIClone runs successfully

Actual Behaviour

  • EFIClone exits with an error:

5 parameters were passed in. This is an unsupported number of parameters. Exiting now

Explore alternative file copy methods

The first, simple version of the script just uses the standard cp command.

Explore other, potentially more robust, file copy methods... rsync?

Are there any macOS-native command line options that will do validation during the copy process?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.