Mounting snapshots

New to OpenZFS on OS X (Or ZFS in general)? Ask your questions here!

Mounting snapshots

Postby pennguin » Thu Mar 24, 2016 11:27 am

Hi,

I know this is the OpenZFS forum but I'm using MacZFS on a MacPro running OS X 10.7 and can't upgrade to the OpenZFS project. I am running Mac ZFS 74.3.3 and it has been a very stable installation running for over a year without issues.

I accidentally deleted some files from the filesystem today and want to retrieve them from a snapshot. I do NOT want to roll back to the snapshot entirely.

I've tried without success to mount my snapshots, I get this error:

bash-3.2# zfs mount pool/files@201602211633
cannot open 'pool/files@201602211633': operation not applicable to datasets of this type

Also tried to list the contents of snapshots following directions I found online:

bash-3.2# zfs set snapdir=visible pool/files

The command is accepted, but no .zfs directory ever appears.

I very much appreciate any suggestions.

Thanks,

-Rob
pennguin
 
Posts: 2
Joined: Thu Mar 24, 2016 11:20 am

Re: Mounting snapshots

Postby pennguin » Thu Mar 24, 2016 12:56 pm

I have managed to accomplish the file restore by using zfs clone of the snapshot to create a new filesystem with read/write capabilities. Seems like the snapshots should be mountable directly though. Or at least I should be able to access files in a snapshot through the command line.
pennguin
 
Posts: 2
Joined: Thu Mar 24, 2016 11:20 am

Re: Mounting snapshots

Postby lundman » Thu Mar 24, 2016 2:52 pm

Snapshots should be automatically mounted in ZFS, but that has proven itself to be difficult on OSX, as Apple does not let us call mount from within the kernel. The correct solution is to clone the snapshot as a mount point.

In OSX you can mount the snapshot, manually. Once the Issue 116 gets completed, snapshots should work the same as other platforms.
User avatar
lundman
 
Posts: 1334
Joined: Thu Mar 06, 2014 2:05 pm
Location: Tokyo, Japan

Re: Mounting snapshots

Postby simonpie » Mon Apr 04, 2016 3:34 pm

I have tried to mount snapshots, but it seems not to work right now.

Here is a terminal snippet
Code: Select all
[laposte:: 19:24] [~] % sysctl {spl,zfs}.kext_version
spl.kext_version: 1.4.5-1
zfs.kext_version: 1.4.5-1
[laposte:: 19:26] [~] % zfs list -t snapshot
NAME                                           USED  AVAIL  REFER  MOUNTPOINT
tank@PremierTest                              1,15M      -  1,90M  /Volumes/tank/.zfs/snapshot/PremierTest
tank@ApresConfigurationMessagerie             56,7M      -   606M  /Volumes/tank/.zfs/snapshot/ApresConfigurationMessagerie
tank@ApresRoudCubeEtPremierCourriePourLeGros   101M      -   751M  /Volumes/tank/.zfs/snapshot/ApresRoudCubeEtPremierCourriePourLeGros
tank@AvantHA                                   217M      -   802M  /Volumes/tank/.zfs/snapshot/AvantHA
[laposte:: 19:27] [~] % zfs get snapdir tank
NAME  PROPERTY  VALUE    SOURCE
tank  snapdir   visible  local
[laposte:: 19:27] [~] % sudo zfs mount tank@AvantHA
cannot mount 'tank@AvantHA': No such file or directory
[laposte:: 19:27] [~] % sudo zfs mount tank@ApresConfigurationMessagerie
cannot mount 'tank@ApresConfigurationMessagerie': No such file or directory
[laposte:: 19:29] [~] % sudo zfs mount tank@PremierTest
cannot mount 'tank@PremierTest': snapshot already mounted
[laposte:: 19:30] [~] % cd /Volumes/tank/.zfs/snapshot
[laposte:: 19:30] [tank/.zfs/snapshot] % ls
ApresConfigurationMessagerie            ApresRoudCubeEtPremierCourriePourLeGros AvantHA                                 PremierTest
[laposte:: 19:30] [tank/.zfs/snapshot] % cd PremierTest/
[laposte:: 19:30] [.zfs/snapshot/PremierTest] % ls
ls: .: Operation not supported
[laposte:: 19:30] [.zfs/snapshot/PremierTest] % ls -l
ls: .: Operation not supported
[laposte:: 19:30] [.zfs/snapshot/PremierTest] % cd ..
[laposte:: 19:30] [tank/.zfs/snapshot] % ls -l
total 2
crw-rw-rw-      1 root  wheel    4, 107 29 mar 19:53 ApresConfigurationMessagerie
dr-xr-xr-x  51968 root  wheel    13465141656313252608 29 mar 19:54 ApresRoudCubeEtPremierCourriePourLeGros
crw-rw-rw-      1 root  wheel    4, 108 29 mar 19:53 AvantHA
dr-xr-xr-x  26578 root  wheel    2230937554 29 mar 19:54 PremierTest
[laposte:: 19:30] [tank/.zfs/snapshot] % sudo zfs unmount tank@AvantHA
cannot unmount snapshot 'tank@AvantHA': not currently mounted
[laposte:: 19:31] [tank/.zfs/snapshot] % sudo zfs unmount tank@PremierTest
Running process: '/usr/sbin/diskutil' 'unmount' '/Volumes/tank/.zfs/snapshot/PremierTest'
Unmount failed for /Volumes/tank/.zfs/snapshot/PremierTest
cannot unmount '/Volumes/tank/.zfs/snapshot/PremierTest': umount failed
[laposte:: 19:31] [tank/.zfs/snapshot] %


two of the mounts even transformed my snapshots into character special files. I guess I will need to reboot to correct this.
simonpie
 
Posts: 7
Joined: Thu Feb 04, 2016 9:17 am


Return to Absolute Beginners Section

Who is online

Users browsing this forum: No registered users and 2 guests