Difference between revisions of "Suppressing the annoying pop-up"

From OpenZFS on OS X
Jump to: navigation, search
(Modify /etc/fstab to tell OSX not to mount the partitions with those UUIDs)
 
(12 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
[[Category:Integration]]
 
[[Category:Integration]]
<!-- (Originally written by alanruttenberg) -->
 
  
== Problem ==
+
As of version 1.3.0, you should not see the message "The disk you inserted was not readable by this computer" unless one or more devices in your pool is a partition with a type code specifying a file system other than ZFS. The correct [http://en.wikipedia.org/wiki/GUID_Partition_Table#Partition_type_GUIDs partition type GUID] for OpenZFS on OS X is "6A898CC3-1DD2-11B2-99A6-080020736631," which may display as any of the following, depending on what tool you're using:
You are getting messages "The disk you inserted was not readable by
+
this computer" for disks you have added to a ZFS pool. This was originally reported as [https://github.com/openzfsonosx/zfs/issues/102 issue 102]
+
  
== Background ==
+
* bf01
 +
* ZFS
 +
* EFI_USR
 +
* Solaris /usr & Mac ZFS
 +
* 6A898CC3-1DD2-11B2-99A6-080020736631
  
OSX tries to mount all disks but doesn't know about ZFS. In order to
+
The easiest way to correct the partition type is to use [http://www.rodsbooks.com/gdisk/ gdisk] which is distributed via [http://brew.sh Homebrew] as the formula "gptfdisk" or via [http://sourceforge.net/projects/gptfdisk/files/gptfdisk/ SourceForge] as a pkg installer. The gdisk function for changing partition type is "t," as explained [http://www.rodsbooks.com/gdisk/gdisk.html here].
work around the error message we will exploit the fact that
+
diskarbitration is forgiving. As long as OSX has one valid partition
+
it will not complain.
+
  
When you use diskutil to view information about a disk you have added
+
'''Warning''': as of El Capitan (10.11) and later, [http://www.rodsbooks.com/gdisk/ Apple has blocked normal methods of modifying a partition type] (such as those mentioned in the preceding paragraph), through a mechanism called "System Integrity Protection" (SIP). You will have to use one of the following methods (starting with the easiest):
to a zpool, you will see two partitions, partition 1 and partition
+
9. Partition 9 is unused by ZFS. To satisfy OSX we will use partition 9,
+
changing it to a partition type that OSX knows about and formatting a file system on it. Then we will
+
tell OSX not to bother mounting it by adding an entry to /etc/fstab
+
  
You will need software called "gdisk" to do some of this. Get it [http://sourceforge.net/projects/gptfdisk/files/gptfdisk/0.8.8/gdisk-binaries/ here]
+
* Boot an earlier version of Mac OS X (e.g. 10.6), and use it to run gdisk as outlined above on the disk containing your target partition.
  
== Step by step ==
+
* boot using a Linux emergency disk and use it to run gdisk on the disk containing your target partition.
  
# Save the output of diskutil list
+
* figure out how to disable Apple's "System Integrity Protection", then run gdisk.
# Backup all your partition tables
+
# Change the type of partition 9 on any disks that are in the zpool to 'Microsoft basic data', a type that is used by FAT and EXFAT file systems.
+
# Reboot
+
# Format each of the partition 9s you've changed the type on using  the newfs_exfat command
+
# Use diskutil to get the UUIDs of the partitions you've just formatted
+
# Modify /etc/fstab to tell OSX not to mount the partitions with those UUIDs
+
# Reboot and be happy
+
  
=== Save the output of diskutil list ===
+
For further information, see the gdisk home page link above.
  
In terminal execute <code>diskutil list</code> and save it. The entries for your ZFS disks will look something like the following. Mine looked like [http://pastebin.com/jUV8cfcA this].
+
Please '''note''' that you don't need to worry about fs type in the case you use coreStorage based encryption as explained in the [[encryption]] wiki page.
<pre>
+
/dev/disk4
+
  #:                      TYPE NAME                    SIZE      IDENTIFIER
+
  0:      GUID_partition_scheme                        *1.5 TB    disk4
+
  1:                        ZFS                        1.5 TB    disk4s1
+
  2: 6A945A3B-1DD2-11B2-99A6-080020736631              8.4 MB    disk4s9
+
</pre>
+
 
+
=== Backup all your partition tables ===
+
 
+
You use gdisk for this. To work with the disk above, /dev/disk4, run <code>sudo gdisk /dev/disk4</code>. It will say something like the following
+
 
+
<pre>
+
GPT fdisk (gdisk) version 0.8.8
+
 
+
Warning: Devices opened with shared lock will not have their
+
partition table automatically reloaded!
+
Partition table scan:
+
  MBR: protective
+
  BSD: not present
+
  APM: not present
+
  GPT: present
+
 
+
Found valid GPT with protective MBR; using GPT.
+
 
+
Command (? for help): 
+
</pre>
+
 
+
Entering "?"[return] gives the list of commands (all single letter)
+
<pre>
+
b back up GPT data to a file
+
c change a partition's name
+
d delete a partition
+
i show detailed information on a partition
+
l list known partition types
+
n add a new partition
+
o create a new empty GUID partition table (GPT)
+
p print the partition table
+
q quit without saving changes
+
r recovery and transformation options (experts only)
+
s sort partitions
+
t change a partition's type code
+
v verify disk
+
w write table to disk and exit
+
x extra functionality (experts only)
+
? print this menu
+
</pre>
+
 
+
Type "b"[return] to backup your partition table. It prompts <code>Enter backup filename to save: </code>. Give it a name - it will save the backup in your current directory.
+
 
+
Repeat this for all the disks listed by diskutul.
+
 
+
=== Change the type of partition 9 on any disks that are in the zpool to 'Microsoft basic data' ===
+
 
+
To change the partition type use gdisk again. You are going to do this *only for the disks in your ZFS pools*. One of mine was /dev/disk4 so <code>sudo gdisk /dev/disk4</code>. Type "t"[return]. It will prompt for the partition number, which will always be "9" and then say something like:
+
 
+
<pre>
+
Command (? for help): t
+
Partition number (1-9): 9
+
Current type is 'Solaris Reserved 1'
+
Hex code or GUID (L to show codes, Enter = AF00):
+
</pre>
+
 
+
Enter "0700"[return]. The response should be
+
 
+
<pre>
+
Changed type of partition to 'Microsoft basic data'
+
Command (? for help):
+
</pre>
+
 
+
Use "w"[return] to save this.
+
 
+
Repeat for each of the disks in your ZFS pools. Once you are done, reboot.
+
 
+
=== Reboot ===
+
 
+
=== Format each of the partition 9s you've changed the type on ===
+
 
+
The command to do this is newfs_exfat, which comes with OSX. For my disk4 the command is <code> sudo newfs_exfat /dev/rdisk4s9 </code>. Note that the /dev/disk description is different than above. First we use /dev/ "rdisk" instead of "disk", and second both the drive number and the partition number (suffix "s9") are in the name.
+
 
+
The command will respond with something like (the specifics will be different for your disk).
+
 
+
<pre>
+
Partition offset : 1953507328 sectors (1000195751936 bytes)
+
Volume size      : 16384 sectors (8388608 bytes)
+
Bytes per sector : 512
+
Bytes per cluster: 4096
+
FAT offset      : 128 sectors (65536 bytes)
+
# FAT sectors    : 128
+
Number of FATs  : 1
+
Cluster offset  : 256 sectors (131072 bytes)
+
# Clusters      : 2016
+
Volume Serial #  : 52a0c680
+
Bitmap start    : 2
+
Bitmap file size : 252
+
Upcase start    : 3
+
Upcase file size : 5836
+
Root start      : 5
+
</pre>
+
 
+
Repeat this for each partition 9 of a disk in your zpools.
+
 
+
=== Use diskutil to get the UUIDs of the partitions you've just formatted ===
+
 
+
The <i>slick</i> way to get the UUID is with a command <code>exfat.util</code>, hidden away in your /System folder.
+
 
+
<pre>
+
sudo /System/Library/Filesystems/exfat.fs/exfat.util -k disk4s9
+
</pre>
+
 
+
The response should look like a UUID. In my case <b>4AEF07DA-8B2B-375C-919B-2441DE07FE8A</b>.
+
 
+
Repeat for each of the partition 9s in your zpool disks, recording the UUIDs.
+
 
+
=== Modify /etc/fstab to tell OSX not to mount the partitions with those UUIDs ===
+
 
+
You could use a text editor, e. g. <code>sudo pico /etc/fstab/</code>, but you can also use a one-liner, one for each of the UUIDs you retrieved in the previous step.
+
 
+
<pre>
+
echo 'UUID=4AEF07DA-8B2B-375C-919B-2441DE07FE8A none exfat ro,noauto' | sudo tee -a /etc/fstab
+
</pre>
+
 
+
Use <i>your</i> UUIDs, of course.
+
 
+
=== Reboot ===
+
 
+
You should no longer get the complaint about the unreadable disks. Enjoy!
+
 
+
== Original IRC Chat ==
+
 
+
Raw notes are below. I will clean up later.
+
<pre>
+
[12:57pm] ilovezfs: hey
+
[12:58pm] alanruttenberg: Hi all, following up on https://github.com/openzfsonosx/zfs/issues/102
+
[12:58pm] alanruttenberg: "The disk you inserted was not readable by this computer"
+
[12:58pm] alanruttenberg: Suggestions?
+
[12:59pm] ilovezfs: so the "trick" is based on exploiting diskarbitration's being forgiving
+
[12:59pm] alanruttenberg: do tell
+
[12:59pm] ilovezfs: as long as one partition is "understood" then it will not give u the popup
+
[12:59pm] ilovezfs: so right now we have 2 partitions, but it understands neither
+
[1:00pm] alanruttenberg: how do you add one, given that I've given the whole disk to zfs
+
[1:00pm] ilovezfs: because it's not really the whole disk
+
[1:00pm] ilovezfs: zfs partitions it behind ur back
+
[1:00pm] alanruttenberg: sneaky
+
[1:00pm] ilovezfs: u get partition 1 and partition 9
+
[1:01pm] alanruttenberg: was wondering about  that
+
[1:01pm] ilovezfs: but it is still considered "whole disk" because if u give zfs a whole disk then it's supposed to be allowed to a) partition it b) flip on the disk cache if it can
+
[1:01pm] alanruttenberg: (does the current version even allow giving just one partition?)
+
[1:02pm] ilovezfs: yes.
+
[1:02pm] ilovezfs: if u built from source
+
[1:02pm] alanruttenberg: getting there...
+
[1:02pm] ilovezfs: there was a bug a few commits ago
+
[1:02pm] ilovezfs: that prevented that
+
[1:02pm] ilovezfs: but was fixed
+
[1:02pm] alanruttenberg: I did try to build the bundle, btw, but it didn't seem to help - maybe I did something wrong
+
[1:03pm] ilovezfs: the bundle definitely works
+
[1:03pm] ilovezfs: if u want to go that route
+
[1:03pm] ilovezfs: but can't guarantee it will hold up in the future
+
[1:03pm] alanruttenberg: hmm. is there any dependency on the version? I built only the bundle.
+
[1:03pm] ilovezfs: since apple plans not to let us write to /System
+
[1:03pm] alanruttenberg: In any case, I'll go sneaky for now if you give me the recipe
+
[1:03pm] alanruttenberg: not at all? It's my machine!
+
[1:04pm] ilovezfs: yeah, tell me about it.
+
[1:04pm] ilovezfs: lol
+
[1:04pm] alanruttenberg: How are they going to enforce it? Might finally have to quit using OSX if they do that.
+
[1:04pm] ilovezfs: anyway, basically u can put an exfat or hfs file system on part 9
+
[1:05pm] ilovezfs: and then put an fstab entry to tell it not to mount that
+
[1:05pm] alanruttenberg: so just use disk utility?
+
[1:05pm] ilovezfs: no
+
[1:05pm] alanruttenberg: ok. how then?
+
[1:05pm] ilovezfs: well for going forward u could have it automatically done
+
[1:05pm] ilovezfs: setting the type code
+
[1:05pm] ilovezfs: but since ur stuff already exists
+
[1:05pm] ilovezfs: we want to change it manually
+
[1:06pm] ilovezfs: the easiest way is to use gdisk
+
[1:06pm] ilovezfs: but that doesn't ship with OS X
+
[1:06pm] alanruttenberg: does fink have it?
+
[1:06pm] ilovezfs: the harder way is to use gpt
+
[1:06pm] ilovezfs: http://www.rodsbooks.com/gdisk/
+
[1:07pm] ilovezfs: http://sourceforge.net/projects/gptfdisk/
+
[1:07pm] alanruttenberg: fink does. 0.8.5-2
+
[1:07pm] alanruttenberg: any reason not to use the fink version?
+
[1:07pm] ilovezfs: id just get the one from the website
+
[1:07pm] ilovezfs:  Last Update: 2013-10-14
+
[1:07pm] ilovezfs: doubt fink is up to date
+
[1:08pm] ilovezfs:  Download gdisk-0.8.8.pkg (294.6 kB)
+
[1:08pm] ilovezfs: see
+
[1:08pm] ilovezfs: lol
+
[1:08pm] alanruttenberg: hang on - remoting home
+
[1:08pm] ilovezfs: k
+
[1:11pm] alanruttenberg: ok. gdisk installed
+
[1:11pm] ilovezfs: ok good
+
[1:11pm] ilovezfs: so first pastebin output of diskutil list
+
[1:12pm] alanruttenberg: http://pastebin.com/jUV8cfcA
+
[1:12pm] ilovezfs: ok
+
[1:12pm] ilovezfs: so first let's backup all of your partition tables
+
[1:13pm] ilovezfs: gdisk uses the command 'b' for that
+
[1:13pm] ilovezfs: sudo gdisk /dev/disk0
+
[1:13pm] ilovezfs: you can type 'p' to see it
+
[1:13pm] alanruttenberg: That's not one of the zfs disks. intended?
+
[1:13pm] ilovezfs: let's just do them all
+
[1:13pm] alanruttenberg: ok
+
[1:14pm] ilovezfs: then type b
+
[1:14pm] ilovezfs: and give the file a name
+
[1:14pm] ilovezfs: say gpt-disk0
+
[1:15pm] ilovezfs: repeat that for all of them
+
[1:15pm] alanruttenberg: k. hang on.
+
[1:18pm] alanruttenberg: mounted disk images too?
+
[1:18pm] ilovezfs: u can skip them
+
[1:19pm] alanruttenberg: ok done
+
[1:19pm] ilovezfs: cool
+
[1:20pm] ilovezfs: so u can change the type code with 't'
+
[1:20pm] ilovezfs: so we're interested in first of all /dev/disk2
+
[1:20pm] ilovezfs: and we'd like to change the type code of partition 9
+
[1:20pm] alanruttenberg: select the partition first or start gdisk with eg. /dev/disk2s9 ?
+
[1:21pm] ilovezfs: no
+
[1:21pm] ilovezfs: sudo gdisk /dev/disk2
+
[1:21pm] ilovezfs: and then type t
+
[1:21pm] alanruttenberg: Current type is 'Solaris Reserved 1'
+
[1:21pm] ilovezfs: right
+
[1:21pm] ilovezfs: so that's what we want to change
+
[1:22pm] alanruttenberg: ok. its asking Hex code or GUID?
+
[1:22pm] ilovezfs: the hex code
+
[1:22pm] ilovezfs: do u want to use exfat or hfs
+
[1:22pm] ilovezfs: exfat is good because it will be obvious to u it's not an apple partition
+
[1:23pm] ilovezfs: but bad because it has the same type code as fat
+
[1:23pm] ilovezfs: but i assume u dont use fat
+
[1:23pm] alanruttenberg: no, other than USB sticks, I guess
+
[1:23pm] ilovezfs: ok
+
[1:24pm] ilovezfs: so u want to use 0700
+
[1:25pm] alanruttenberg: conveniently not listed by the L command
+
[1:25pm] ilovezfs: yes it is
+
[1:25pm] ilovezfs: first one
+
[1:25pm] ilovezfs: lol
+
[1:25pm] ilovezfs:
+
[1:26pm] alanruttenberg: ok done. Just quit now?
+
[1:26pm] ilovezfs: 0700 Microsoft basic data
+
[1:26pm] ilovezfs: so type p
+
[1:26pm] ilovezfs: to confirm it looks good
+
[1:26pm] alanruttenberg:  9      1953507328      1953523711  8.0 MiB    0700
+
[1:26pm] ilovezfs: good
+
[1:26pm] ilovezfs: and the other one is still zfs?
+
[1:26pm] alanruttenberg: yes
+
[1:26pm] ilovezfs: good
+
[1:26pm] ilovezfs: then u can type 'w'
+
[1:26pm] alanruttenberg: do i need a label or will osx give it a guid
+
[1:26pm] ilovezfs: no
+
[1:27pm] ilovezfs: we do the guid later
+
[1:27pm] alanruttenberg: You should reboot or remove the drive.
+
[1:27pm] alanruttenberg: The operation has completed successfully.
+
[1:27pm] ilovezfs: perfect
+
[1:27pm] ilovezfs: now u can see ur work
+
[1:27pm] ilovezfs: diskutil list
+
[1:27pm] alanruttenberg:  #:                      TYPE NAME                    SIZE      IDENTIFIER
+
[1:27pm] alanruttenberg:  0:      GUID_partition_scheme                        *1.0 TB    disk2
+
[1:27pm] alanruttenberg:  1:                        ZFS                        1.0 TB    disk2s1
+
[1:27pm] alanruttenberg:  2:      Microsoft Basic Data                        8.4 MB    disk2s9
+
[1:27pm] ilovezfs: voila
+
[1:28pm] ilovezfs: ok
+
[1:28pm] ilovezfs: now do the others
+
[1:28pm] alanruttenberg: ok
+
[1:28pm] ilovezfs: so disk3
+
[1:28pm] ilovezfs: disk4
+
[1:28pm] ilovezfs: disk5
+
[1:28pm] ilovezfs: let me know when ur done
+
[1:30pm] alanruttenberg: done
+
[1:30pm] ilovezfs: cool
+
[1:30pm] ilovezfs: now we can put a file system on them
+
[1:30pm] ilovezfs: the command is newfs_exfat
+
[1:31pm] ilovezfs: tecnically u should give it the raw version of the partition
+
[1:31pm] ilovezfs: but it will correct u if u dont
+
[1:31pm] ilovezfs: sudo newfs_exfat /dev/rdisk2s9
+
[1:31pm] alanruttenberg: args?
+
[1:31pm] ilovezfs: or u can do sudo newfs_exfat /dev/disk2s9 if u want to be "sloppy" hehe
+
[1:32pm] alanruttenberg: Partition offset : 1953507328 sectors (1000195751936 bytes)
+
[1:32pm] alanruttenberg: Volume size      : 16384 sectors (8388608 bytes)
+
[1:32pm] alanruttenberg: Bytes per sector : 512
+
[1:32pm] alanruttenberg: Bytes per cluster: 4096
+
[1:32pm] alanruttenberg: FAT offset      : 128 sectors (65536 bytes)
+
[1:32pm] alanruttenberg: # FAT sectors    : 128
+
[1:32pm] alanruttenberg: Number of FATs  : 1
+
[1:32pm] alanruttenberg: Cluster offset  : 256 sectors (131072 bytes)
+
[1:32pm] alanruttenberg: # Clusters      : 2016
+
[1:32pm] alanruttenberg: Volume Serial #  : 52a0c680
+
[1:32pm] alanruttenberg: Bitmap start    : 2
+
[1:32pm] alanruttenberg: Bitmap file size : 252
+
[1:32pm] alanruttenberg: Upcase start    : 3
+
[1:32pm] alanruttenberg: Upcase file size : 5836
+
[1:32pm] alanruttenberg: Root start      : 5
+
[1:32pm] ilovezfs: perfect
+
[1:32pm] alanruttenberg: will do others
+
[1:32pm] ilovezfs: then repeat on each of ur partition 9s
+
[1:34pm] alanruttenberg: ok done
+
[1:34pm] ilovezfs: good
+
[1:34pm] ilovezfs: now we can get the UUID for the file systems
+
[1:34pm] ilovezfs: that u just made
+
[1:34pm] ilovezfs: so the slick way
+
[1:35pm] ilovezfs: sudo /System/Library/Filesystems/exfat.fs/exfat.util -k disk2s9
+
[1:35pm] ilovezfs: try that
+
[1:35pm] alanruttenberg: 4AEF07DA-8B2B-375C-919B-2441DE07FE8A
+
[1:35pm] ilovezfs: cool
+
[1:35pm] ilovezfs: so u can do
+
[1:35pm] ilovezfs: sudo /System/Library/Filesystems/exfat.fs/exfat.util -k disk2s9 | pbcopy
+
[1:35pm] ilovezfs: and it will put it on the clipboard
+
[1:36pm] ilovezfs: then we make an fstab entry
+
[1:36pm] ilovezfs: echo 'UUID=4AEF07DA-8B2B-375C-919B-2441DE07FE8A none exfat ro,noauto' | sudo tee -a /etc/fstab
+
[1:37pm] ilovezfs: and repeat that for each of them
+
[1:37pm] alanruttenberg: k
+
[1:38pm] ilovezfs: and it should now shut the fuck up
+
[1:38pm] ilovezfs:
+
[1:39pm] ilovezfs: make sense?
+
[1:42pm] alanruttenberg: very nice, thank you. Rebooting now...
+
[1:42pm] ilovezfs: cool
+
[1:42pm] ilovezfs: i assume u dont have file vault so it can actually reboot right
+
[1:43pm] alanruttenberg: no file vault
+
[1:43pm] ilovezfs: k
+
[1:43pm] ilovezfs: otherwise there's other magic for that lol
+
[1:45pm] alanruttenberg: if remote access doesn't let me reconnect will have to check later. It's taking its time.
+
[1:45pm] ilovezfs: k
+
[1:45pm] ilovezfs: it should come up
+
[1:46pm] alanruttenberg: thank you very much!
+
[1:46pm] ilovezfs: You're welcome
+
[1:46pm] alanruttenberg: Is there a wiki where I can write this up for others?
+
[1:46pm] ilovezfs: um
+
[1:46pm] ilovezfs: not really
+
[1:46pm] ilovezfs: i guess u could
+
[1:46pm] ilovezfs: https://github.com/openzfsonosx/zfs/wiki
+
[1:46pm] ilovezfs: lol
+
[1:46pm] ilovezfs:
+
[1:47pm] ilovezfs: does it let u?
+
[1:47pm] alanruttenberg: might as well return the favor. seems to.
+
[1:47pm] alanruttenberg: ok, later!
+
[1:47pm] ilovezfs: alanruttenberg: awesome
+
[1:48pm] ilovezfs: alanruttenberg: will look forward to the write up
+
[1:48pm] ilovezfs: alanruttenberg:
+
[1:48pm] alanruttenberg: will drop a note in the issue when done
+
</pre>
+

Latest revision as of 03:32, 23 January 2017


As of version 1.3.0, you should not see the message "The disk you inserted was not readable by this computer" unless one or more devices in your pool is a partition with a type code specifying a file system other than ZFS. The correct partition type GUID for OpenZFS on OS X is "6A898CC3-1DD2-11B2-99A6-080020736631," which may display as any of the following, depending on what tool you're using:

  • bf01
  • ZFS
  • EFI_USR
  • Solaris /usr & Mac ZFS
  • 6A898CC3-1DD2-11B2-99A6-080020736631

The easiest way to correct the partition type is to use gdisk which is distributed via Homebrew as the formula "gptfdisk" or via SourceForge as a pkg installer. The gdisk function for changing partition type is "t," as explained here.

Warning: as of El Capitan (10.11) and later, Apple has blocked normal methods of modifying a partition type (such as those mentioned in the preceding paragraph), through a mechanism called "System Integrity Protection" (SIP). You will have to use one of the following methods (starting with the easiest):

  • Boot an earlier version of Mac OS X (e.g. 10.6), and use it to run gdisk as outlined above on the disk containing your target partition.
  • boot using a Linux emergency disk and use it to run gdisk on the disk containing your target partition.
  • figure out how to disable Apple's "System Integrity Protection", then run gdisk.

For further information, see the gdisk home page link above.

Please note that you don't need to worry about fs type in the case you use coreStorage based encryption as explained in the encryption wiki page.