If I connect a external GUID-Formated Mac Drive, the Finder does mount all partitions except the "hidden" ones EFI and if existing "Recovery HD". That's fine so far.

If I unmount the disk in the command line with "diskutil unmountDisk /dev/disk3" it will be unmounted. Also fine. But if I then do the opposite with "diskutil mountDisk /dev/disk3", this command will not only mount the relevant data partitions but as well the "EFI" partition and if existing also the "Recovery HD" partition.

As it looks there is no command which behaves like the Finder, I have to extract the disk informations with the diskutility command. Right now, with diskutil list $(diskutil list | grep 'external' | awk '{print $1}') I get the following output.

/dev/disk3 (external, physical): #: TYPE NAME SIZE IDENTIFIER 0: GUID_partition_scheme *2.0 TB disk3 1: EFI EFI 209.7 MB disk3s1 2: Apple_HFS Server SSD Clone 127.5 GB disk3s2 3: Apple_Boot Recovery HD 650.0 MB disk3s3 4: Apple_HFS Server HDD clone 1000.0 GB disk3s4 5: Apple_HFS Free Space 100.0 GB disk3s5 6: Apple_HFS Backup 771.6 GB disk3s6

Now I search string manipulations to extract the "NAME" and "IDENTIFIER" information based on filtering out the "TYPE" and "IDENTIFIER" information and exclude the "TYPE" "EFI" and "Apple_Boot".

In the end I should get something like

Repeat until last partition
  Part_NAME="Server SSD Clone", Part_ID="disk3s2"
  Diskutil mountDisk /dev/$Part_ID

Somewhere else I did read that it is needed to mount partitions by there UUID and NOT by "NAME" or "IDENTIFIER". With the command diskutil info /dev/disk3 you get this information but then it's needed to extract the "Volume UUID:" from the result.

I would appreciate any suggestions either to part of my question or to a other way to get it done.

Thank you for your help. Regards Thomas

  • What are the results of the following- diskutil list external physical ? I suspect that the results are the same as above. – fd0 May 25 '19 at 16:14
  • Yep, that's true. I could also just type diskutil list external to get the same result. Still I need to filter-out rows like GUID_partition_scheme, EFI, Apple_Boot, ... and put it into a loop to mount only the relevant partitions. – thotha May 25 '19 at 21:47
  • The mounting process is normally handled by the diskarbitrationd daemon, which gets notified of newly attached devices, decides which volumes to mount, and mounts them. There might be a way to fake a new device notification and get it to do its usual mount process on an already-attached device, but I don't know how. – Gordon Davisson May 27 '19 at 8:06

You must log in to answer this question.

Browse other questions tagged .