Is there an optimal method of making a complete copy of a ZFS, aside from the conventional methods (tar, cpio)? We have an existing ZFS that was not created with the optimal recordsize. We wish to create a new ZFS with the optimal recordsize (8k), and copy all the data from the existing ZFS to the new ZFS. Obviously, we know how to do this using conventional utilities and commands. Is there a ZFS-specific method for doing that beats the heck of out tar, etc? (RTFM indicates there is not; I R''d the FM :^). This may or may not be a copy to the same zpool, and I''d also be interested in knowing of that makes a difference (I do not think it does)? Thanks, /jim This message posted from opensolaris.org
2008/7/20 James Mauro <James.Mauro at sun.com>:> Is there an optimal method of making a complete copy of a ZFS, aside from the conventional methods (tar, cpio)? > > We have an existing ZFS that was not created with the optimal recordsize. > We wish to create a new ZFS with the optimal recordsize (8k), and copy > all the data from the existing ZFS to the new ZFS. > > Obviously, we know how to do this using conventional utilities and commands. > > Is there a ZFS-specific method for doing that beats the heck of out tar, etc? > (RTFM indicates there is not; I R''d the FM :^).Use zfs send | zfs receive if you wish to keep your snapshots or if you will be doing the copy several times. You can send just the changes between two snapshots. (zfs send is in the FM :-)> > This may or may not be a copy to the same zpool, and I''d also be interested in > knowing of that makes a difference (I do not think it does)?It does not.
On Sun, 20 Jul 2008, Mattias Pantzare wrote:>> >> Is there a ZFS-specific method for doing that beats the heck of out tar, etc? >> (RTFM indicates there is not; I R''d the FM :^). > > Use zfs send | zfs receive if you wish to keep your snapshots or if > you will be doing the copy several times. You can send just the > changes between two snapshots.The problem is that ''zfs send'' likely preserves the existing block size even if the target pool uses a different block size since it operates at a low level which intends to preserve the original zfs blocks. I would use ''find . -depth -print | cpio -pdum destdir'' to do the copy. Bob =====================================Bob Friesenhahn bfriesen at simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/ GraphicsMagick Maintainer, http://www.GraphicsMagick.org/
So I''m really exposing my ignorance here, but... You wrote "/... if you wish to keep your snapshots.../"... I never mentioned snapshots, thus you introduced the use of a ZFS snapshot as a method of doing what I wish to do. And yes, snapshots and send are in the manual, and I read about them. I intially (and perhaps incorrectly) rejected the use of snapshots for my purposes since a snapshot is, by definition, a read-only copy of the file system. What I need to do is copy the file system in it''s entirety, so I can mount the new file system read/write for online, production use. Perhaps I should have been clearer about that. I will investigate using ZFS snapshots with ZFS send as a method for accomplishing my task. I''m not convinced it''s the best way to acheive my goal, but if it''s not, I''d like to make sure I understand why not. Thanks for your interest. /jim Mattias Pantzare wrote:> 2008/7/20 James Mauro <James.Mauro at sun.com>: > >> Is there an optimal method of making a complete copy of a ZFS, aside from the conventional methods (tar, cpio)? >> >> We have an existing ZFS that was not created with the optimal recordsize. >> We wish to create a new ZFS with the optimal recordsize (8k), and copy >> all the data from the existing ZFS to the new ZFS. >> >> Obviously, we know how to do this using conventional utilities and commands. >> >> Is there a ZFS-specific method for doing that beats the heck of out tar, etc? >> (RTFM indicates there is not; I R''d the FM :^). >> > > Use zfs send | zfs receive if you wish to keep your snapshots or if > you will be doing the copy several times. You can send just the > changes between two snapshots. > > (zfs send is in the FM :-) > > >> This may or may not be a copy to the same zpool, and I''d also be interested in >> knowing of that makes a difference (I do not think it does)? >> > > It does not. > _______________________________________________ > zfs-discuss mailing list > zfs-discuss at opensolaris.org > http://mail.opensolaris.org/mailman/listinfo/zfs-discuss >
Jim Mauro wrote:> So I''m really exposing my ignorance here, but... > > You wrote "/... if you wish to keep your snapshots.../"... > I never mentioned snapshots, thus you > introduced the use of a ZFS snapshot as a method of doing what > I wish to do. And yes, snapshots and send are in the manual, and > I read about them. > > I intially (and perhaps incorrectly) rejected the use of snapshots for > my purposes since a snapshot is, by definition, a read-only copy > of the file system. What I need to do is copy the file system in it''s > entirety, so I can mount the new file system read/write for online, > production use. Perhaps I should have been clearer about that. > > I will investigate using ZFS snapshots with ZFS send as a method > for accomplishing my task. I''m not convinced it''s the best way > to acheive my goal, but if it''s not, I''d like to make sure I understand > why not.Hi Jim, I agree with Mattias - snapshots are the way to achieve this. The bit you might, perhaps, have missed is the _clone_ requirement so you can have read and write access: # zfs snapshot sink/data at date # zfs clone sink/data at date sink/newcopyofdata Or if you do want to use zfs send/recv # zfs snapshot sink/data at date # zfs send -R sink/data at date | zfs recv -d newzpool/dataset> Mattias Pantzare wrote: >> 2008/7/20 James Mauro <James.Mauro at sun.com>: >> >>> Is there an optimal method of making a complete copy of a ZFS, aside from the conventional methods (tar, cpio)? >>> >>> We have an existing ZFS that was not created with the optimal recordsize. >>> We wish to create a new ZFS with the optimal recordsize (8k), and copy >>> all the data from the existing ZFS to the new ZFS. >>> >>> Obviously, we know how to do this using conventional utilities and commands. >>> >>> Is there a ZFS-specific method for doing that beats the heck of out tar, etc? >>> (RTFM indicates there is not; I R''d the FM :^). >>> >> Use zfs send | zfs receive if you wish to keep your snapshots or if >> you will be doing the copy several times. You can send just the >> changes between two snapshots. >> >> (zfs send is in the FM :-) >> >> >>> This may or may not be a copy to the same zpool, and I''d also be interested in >>> knowing of that makes a difference (I do not think it does)? >>> >> It does not.James C. McPherson -- Senior Kernel Software Engineer, Solaris Sun Microsystems http://blogs.sun.com/jmcp http://www.jmcp.homeunix.com/blog
Hello Bob, Sunday, July 20, 2008, 5:08:23 PM, you wrote: BF> On Sun, 20 Jul 2008, Mattias Pantzare wrote:>>> >>> Is there a ZFS-specific method for doing that beats the heck of out tar, etc? >>> (RTFM indicates there is not; I R''d the FM :^). >> >> Use zfs send | zfs receive if you wish to keep your snapshots or if >> you will be doing the copy several times. You can send just the >> changes between two snapshots.BF> The problem is that ''zfs send'' likely preserves the existing block BF> size even if the target pool uses a different block size since it BF> operates at a low level which intends to preserve the original zfs BF> blocks. I''m not 100% sure but it actually doesn''t preserve recordsize. -- Best regards, Robert Milkowski mailto:milek at task.gda.pl http://milek.blogspot.com