Skip to content

Instantly share code, notes, and snippets.

@arobb
Last active March 20, 2016 01:38
Show Gist options
  • Save arobb/9d1c4a21bf67a01ff5e3 to your computer and use it in GitHub Desktop.
Save arobb/9d1c4a21bf67a01ff5e3 to your computer and use it in GitHub Desktop.
Access ZFS array on Mac without Open ZFS on OS X (O3X)
#
# Access ZFS array on Mac without Open ZFS on OS X (O3X)
#
# Origin: O3X crashing computer, and drive array could not be attached
# as a complete set (as a USB device) to a VM. Used only as recovery
# mechanism to extract data from the ZFS array. ZFS is not fully
# supported on Ubuntu 15 (should be baked into 16).
#
# Requires raw access to the disks: directly attach as USB device
# or (as in this description) disks are accessed as raw devices
# that are visible but not mounted in the host
#
0.0. To the extent possible, export the pool
0.1. Uninstall O3X/other ZFS driver from the Mac
0.2. Attach the drive(s) to the Mac; they won't be mounted since the OS no longer knows what they are
1.0. Create Linux virtual machine (Ubuntu 15.10 desktop in VirtualBox worked)
1.1. Install/update VM helpers (e.g. VBox Guest Additions)
2.0. Install ZFS support in the VM: https://wiki.ubuntu.com/Kernel/Reference/ZFS
sudo apt-get install zfsutils-linux
3.0. Shutdown the VM
4.0. Create raw disk files on the Mac, one per disk in ZFS array: https://forums.virtualbox.org/viewtopic.php?t=9223#p66028
1.0 Open a Terminal and Sudo yourself: sudo su
2.0 Check your disk layout: df -k
2.1 Pick your disk out of the list so you know it's disk number. In my case it was the Store volume, disk0s2.
3.0 Eject the Volume in the Finder or Unmount it in Disk Utility
3.1 Give VBox access to the drive: chmod 777 /dev/disk0s2
4.0 Give the command: VBoxManage internalcommands createrawvmdk -filename /Users/Jay/Library/VirtualBox/HardDisks/Store.vmdk -rawdisk /dev/disk0s2 -register
5.0 Give access to the image file: chmod -R 777 /Users/jay/Library/VirtualBox/HardDisks/Store.vmdk
5.0. Mount those files as disks in the VM
6.0. Start the VM
7.0. Mount the disk array in the VM
sudo zpool import tank
7.1. --Pool should now be availabe under /Volumes--
8.0. (If you are moving files off the array) Share a directory from the Mac into the VM
9.0. Mount the shared directory in the VM: https://help.ubuntu.com/community/VirtualBox/SharedFolders
sudo mount -t vboxsf -o uid=$UID,gid=$(id -g) share ~/host
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment