mnh wrote:> Hi, > > I was wondering if there is any way to read a ZFS snapshot using > system/zfs lib (ie refer to it as a block device). > I dug through the libzfs source but could not find anything that could > enable me to ''read'' the contents of a > snapshot/filesystem.Why ? What problem are you trying to solve ? Given that you can''t read the filesystem as a block device in the first place why would it make sense to do so for a snapshot of filesystem ? -- Darren J Moffat
mnh wrote:> Darren J Moffat wrote: > >> mnh wrote: >> >>> Hi, >>> >>> I was wondering if there is any way to read a ZFS snapshot using >>> system/zfs lib (ie refer to it as a block device). >>> I dug through the libzfs source but could not find anything that >>> could enable me to ''read'' the contents of a >>> snapshot/filesystem. >> >> >> Why ? What problem are you trying to solve ? > > We are trying to implement a third-party Backup/Restore System for zfs > (including bare metal recovery). Essentially requires > the snapshot to be read and stored in a proprietary format.Is there a reason why you can''t just walk through the snapshot using POSIX APIs ? The snapshot is mounted in <rootofdataset>/.zfs/snapshot/<nameofsnapshot> Or maybe zfs send/recv is what you need.>> >> Given that you can''t read the filesystem as a block device in the >> first place why would it make sense to do so for a snapshot of >> filesystem ? >> > I know it doesn''t make much sense, I was just hoping that zfs''s > snapshots could be used by a different product/vendor.Sure they can but I''m not sure you are approaching the problem from a view that ZFS can give you on the data. It might help if you described how this backup software works for other filesystems, eg UFS. -- Darren J Moffat
Hi, I was wondering if there is any way to read a ZFS snapshot using system/zfs lib (ie refer to it as a block device). I dug through the libzfs source but could not find anything that could enable me to ''read'' the contents of a snapshot/filesystem. What I really want to do would be equivalent/similar to: /ret = read(snapname,buff,1024);/ Thanks, mnh
I think it would be handy if a utility could read a full zfs snapshot and restore subsets of files or directories like using something like tar -xf or ufsrestore -i. This message posted from opensolaris.org
I''m not sure what you want that the file system does not already provide. you can use cp to copy files out, or find(1) to find them based on time or any other attribute and then cpio to copy them out. This message posted from opensolaris.org
Darren J Moffat wrote:> mnh wrote: > >> Hi, >> >> I was wondering if there is any way to read a ZFS snapshot using >> system/zfs lib (ie refer to it as a block device). >> I dug through the libzfs source but could not find anything that >> could enable me to ''read'' the contents of a >> snapshot/filesystem. > > > Why ? What problem are you trying to solve ?We are trying to implement a third-party Backup/Restore System for zfs (including bare metal recovery). Essentially requires the snapshot to be read and stored in a proprietary format.> > Given that you can''t read the filesystem as a block device in the > first place why would it make sense to do so for a snapshot of > filesystem ? >I know it doesn''t make much sense, I was just hoping that zfs''s snapshots could be used by a different product/vendor. Thanks, mnh
Darren J Moffat wrote:> Is there a reason why you can''t just walk through the snapshot using > POSIX APIs ? The snapshot is mounted in > <rootofdataset>/.zfs/snapshot/<nameofsnapshot>We cannot walk through the mounted snapshot as it''s not just the data that we are concerned about. We need to read the complete snapshot (data+metadata).> > Or maybe zfs send/recv is what you need.I looked at zfs send/recv and was pleasantly surprised by its capabilities. Unfortunately it does not fit into our backup agent''s design (NDMP based). The agent reads directly of a snapshot - using zfs send would require additional space to create the backup file. (and we cannot do a zfs send to the destination, even though it would have been nice :) ).> >>> >>> Given that you can''t read the filesystem as a block device in the >>> first place why would it make sense to do so for a snapshot of >>> filesystem ? >>> >> I know it doesn''t make much sense, I was just hoping that zfs''s >> snapshots could be used by a different product/vendor. > > > Sure they can but I''m not sure you are approaching the problem from a > view that ZFS can give you on the data. > > It might help if you described how this backup software works for > other filesystems, eg UFS. >For UFS (as with other filesystems eg. NTFS) - we use the filesystem''s local snapshot mechanism (fssnap/vss). In all cases you can refer to the snapshot as a block device. Thanks, mnh
An example would be if you had a raw snapshot on tape. A single file or subset of files could be restored from it without needing the space to load the full snapshot into a zpool. This would be handy if you have a zpool with 500GB of space and 300GB used. If you had a snapshot that was 250GB and wanted to load it back up to restore a file, you wouldn''t have sufficient space. This message posted from opensolaris.org
On 18-May-07, at 1:57 PM, William D. Hathaway wrote:> An example would be if you had a raw snapshot on tape.Unless I misunderstand ZFS, you can archive the contents of a snapshot, but there''s no concept of a ''raw snapshot'' divorced from a filesystem.> A single file or subset of files could be restored from it without > needing the space to load the full snapshot into a zpool. This > would be handy if you have a zpool with 500GB of space and 300GB > used. If you had a snapshot that was 250GB and wanted to load it > back up to restore a file, you wouldn''t have sufficient space. > > > This message posted from opensolaris.org > _______________________________________________ > zfs-discuss mailing list > zfs-discuss at opensolaris.org > http://mail.opensolaris.org/mailman/listinfo/zfs-discuss