Created
November 21, 2019 10:58
-
-
Save luginbash/80b6a2d4d9398f31717823bf5b4d86a2 to your computer and use it in GitHub Desktop.
"Upgrade" a HFS drive to APFS
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 | |
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
VOL_NAME="Macintosh HD 10142-190404" | |
diskutil apfs addVolume disk3 apfs Preboot -role B | |
VOL_UUID=$(diskutil info disk3s1 | grep "Volume UUID"|awk '{print $(NF)}') | |
mkdir /Volumes/Preboot/${VOL_UUID} | |
diskutil mount disk1s2 | |
SRC_UUID=$(diskutil info disk1s1 | grep "Volume UUID"|awk '{print $(NF)}') | |
sudo rsync -xrlptgoEvHS --progress --delete /Volumes/Preboot\ 1/${SRC_UUID}/ /Volumes/Preboot/${VOL_UUID} | |
diskutil unmount disk1s2 | |
#diskutil unmount disk3s2 | |
diskutil apfs updatePreboot disk3s1 | |
sudo bless --folder "/Volumes/${VOL_NAME}/System/Library/CoreServices" --bootefi | |
sudo update_dyld_shared_cache -root /Volumes/"${VOL_NAME}" -force |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment