Skip to content
This repository has been archived by the owner on Dec 12, 2023. It is now read-only.

Auto detect Volume Format for eraseVolume #200

Merged
merged 3 commits into from
Apr 27, 2018

Conversation

chrisgrande
Copy link
Contributor

What does this PR do?

Setting the eraseVolume format key to "auto_hfs_or_apfs" the eraseVolume component will detect the format (HFS or APFS) of the volume and erase it using the same format.

The default if no format is specified is still JHFS+

What issues does this PR fix or reference?

Currently when moving to 10.13 in a lab environment with mixed machines (HD, SSD, Fusion) the volume format may be different and the would require different workflows to erase the volume correctly.

This change coupled with startosinstall APFS conversion also allows the same workflow to install 10.13 on a 10.12 machine and upgrade it to APFS and 10.13 to be fresh installed on an already APFS volume.

@erikng
Copy link
Contributor

erikng commented Dec 8, 2017

Doesn't apple already handle this when performing an install? We don't format the volumes prior to using startosinstall and we end up with APFS volumes.

I don't think fusion drives are supported yet with APFS.

@chrisgrande
Copy link
Contributor Author

This is for when you want to wipe the drive and install macOS fresh.

@erikng
Copy link
Contributor

erikng commented Dec 8, 2017

With an imaging workflow or startosinstall?

@chrisgrande
Copy link
Contributor Author

startosinstall

@erikng
Copy link
Contributor

erikng commented Dec 8, 2017

Weird. So are you seeing 10.13.x HFS devices (non fusion) not being converted to APFS when using startosinstall?

@chrisgrande
Copy link
Contributor Author

No, they are converted just fine. I think we are talking about different things.

eraseVolume in its current form defaults to JHFS+, you have to specify a volume format. So you can't use the same workflow to fresh install (startosinstall) 10.13 on a current 10.12 machine as you would on an already converted 10.13 or a HFS+ 10.13 machine (Fusion drive). With this change you can.

@erikng
Copy link
Contributor

erikng commented Dec 8, 2017

Are you positive? During the install, Apple will concert the volume to APFS, regardless if it's a new install (blank HFS volume) or an upgrade.

The change is small and harmless, but none of us have seen this behavior, so something isn't adding up.

@gregneagle
Copy link
Contributor

I don't think there's any behavior to "see".
I think Chris is just wanting to erase an existing APFS volume and keep it APFS.

@@ -1676,8 +1676,22 @@ def eraseTargetVolume(self, name='Macintosh HD', format='Journaled HFS+', progre
Erases the target volume.
'name' can be used to rename the volume on reformat.
'format' can be used to specify a format type.
'format' type of 'auto_hfs_or_apfs' will check for HFS+ or APFS
Copy link
Contributor

@clburlison clburlison Dec 8, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you fix this formatting? You likely have a tab character instead of space or vise versa.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@erikng
Copy link
Contributor

erikng commented Dec 8, 2017

Okay I think I may understand what's happening now - Chris is ultimately concerned about accidentally having a Fusion Drive set to APFS and would like to keep the the original drive format.

If and when Apple fully supports fusion drives, startosinstall could upgrade to APFS automatically and this workflow could be left untouched.

@grahamgilbert
Copy link
Collaborator

Whilst this PR looks fairly harmless, I'm not sure I see the need. I am formatting all disks back to JHFS+ and letting the installer decide what to do.

@chrisgrande
Copy link
Contributor Author

chrisgrande commented Dec 8, 2017

@erikng No I'm not concerned about having it accidentally set, I wanted something that would just let startosinstall do its thing, cover any current supported configs, and not have to fully destroy all the partitions to get back to HFS+, since it seems as we have seen with the TouchBar MacBook Pros and I assume the coming iMac Pros will be more trouble than it's worth. @grahamgilbert I assume you are repartitioning since eraseVolume doesn't let you format an APFS volume back to HFS+?

@grahamgilbert
Copy link
Collaborator

@chrisgrande Yes, all of our repurposed computers are encrypted, so we need to blow everything away.

@chrisgrande
Copy link
Contributor Author

@grahamgilbert ahh, that makes sense - yea these are student labs I'm dealing with, thankfully no encryption, but a mix of Fusion and SSD machines.

@grahamgilbert
Copy link
Collaborator

Please update the wiki with this new functionality. It will be in version 1.4.2.

@grahamgilbert grahamgilbert merged commit 42df723 into imagr:master Apr 27, 2018
@mosen
Copy link
Contributor

mosen commented May 2, 2018

I just wanted to question the need to detect the existing volume's format, given that there is a diskutil verb called reformat that effectively does the same without file system detection?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants