Page 1 of 1
Mounting snapshots
Posted:
Thu Mar 24, 2016 11:27 am
by pennguin
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
Re: Mounting snapshots
Posted:
Thu Mar 24, 2016 12:56 pm
by pennguin
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.
Re: Mounting snapshots
Posted:
Thu Mar 24, 2016 2:52 pm
by lundman
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.
Re: Mounting snapshots
Posted:
Mon Apr 04, 2016 3:34 pm
by simonpie
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.