wombat94 / eficlone Goto Github PK
View Code? Open in Web Editor NEWmacOS Shell Scripts to clone the EFI partition automatically from either Carbon Copy Cloner or SuperDuper! when run on a Hackintosh
License: GNU General Public License v2.0
macOS Shell Scripts to clone the EFI partition automatically from either Carbon Copy Cloner or SuperDuper! when run on a Hackintosh
License: GNU General Public License v2.0
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.
5 parameters were passed in. This is an unsupported number of parameters. Exiting now
This will keep the critical, data-modification commands down to a single point of failure and I feel more comfortable that rsync is tried-and-true and reliable in its decision about what to copy/delete.
It also is a slight optimization to the overall process, but frankly that is not a huge concern.
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 ...
Enhance the logging to indicate the volume type of source and destination and if virtual volumes, include the physical disk on which the virtual volume resides.
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.
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.
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.
Add entry code to determine if the script is invoked by either SuperDuper! or CCC. The rest of the script can then be combined into a single codebase.
Need to add messages to the macOS Notification Center to inform the user of either successful completion or some execution reason that does not allow the script to complete successfully.
After the copy is complete, perform some type of file hash checking to determine if the clone partition is an exact duplicate of the source partition.
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 !
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?
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.
After the copy is complete, the SuperDuper! version will sometimes fail to unmount one of the EFI partitions.
This is not a functional failure as the clone has completed successfully, but it causes an error to be reported in SuperDuper!
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?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.