{"id":97,"date":"2009-12-02T22:44:43","date_gmt":"2009-12-03T04:44:43","guid":{"rendered":"http:\/\/www.edplese.com\/blog\/?p=97"},"modified":"2009-12-02T22:58:11","modified_gmt":"2009-12-03T04:58:11","slug":"samba-shadow_copy2-enhancements","status":"publish","type":"post","link":"https:\/\/www.edplese.com\/blog\/2009\/12\/02\/samba-shadow_copy2-enhancements\/","title":{"rendered":"Samba shadow_copy2 Enhancements"},"content":{"rendered":"<p>A few weeks ago there was a <a href=\"http:\/\/lists.samba.org\/archive\/samba\/2009-November\/151940.html\">thread<\/a> on the Samba mailing list regarding some difficulties in getting my <a href=\"http:\/\/www.edplese.com\/samba-with-zfs.html\">shadow copy patches<\/a> to work with newer versions of Samba.\u00a0\u00a0These patches were originally written for Samba 3.0.25, and since then, Samba has moved up to version 3.4.3, with the 3.5.0 release on the horizon.\u00a0 The more recent Samba versions also include a shadow_copy2 module that will likely be replacing the shadow_copy module in the future.<\/p>\n<p>I spent some time today adapting the original patches to the shadow_copy2 module.\u00a0 This patch was made against Samba 3.4.3, and I will be working on a version for Samba 3.5.x over the next couple days.\u00a0 I hope to get this integrated into Samba, but for now, it&#8217;s available below:<\/p>\n<ul>\n<li><a href=\"http:\/\/www.edplese.com\/files\/samba-3.4.3-shadowcopy.patch.gz\">samba-3.4.3-shadowcopy.patch.gz<\/a><\/li>\n<\/ul>\n<p>Creating a patched Samba source tree can be done with:<\/p>\n<pre>$ gzcat samba-3.4.3.tar.gz | tar -xf -\r\n$ cd samba-3.4.3\r\n$ gzcat ..\/samba-3.4.3-shadowcopy.patch.gz | patch -p1<\/pre>\n<p>The parameters added with this patch, as shown at the top of the source file, are:<\/p>\n<pre>shadow:sort = asc\/desc, or blank for unsorted (default)\r\n\r\nThis is an optional parameter that specifies that the shadow\r\ncopy directories should be sorted before sending them to the\r\nclient.\u00a0 This is beneficial for filesystems that don't read\r\ndirectories alphabetically (e.g. ZFS).\u00a0 If enabled, you typically\r\nwant to specify descending order.\r\n\r\nshadow:format = &lt;format specification for snapshot names&gt;\r\n\r\nThis is an optional parameter that specifies the format\r\nspecification for the naming of snapshots.\u00a0 The format must\r\nbe compatible with the conversion specifications recognized\r\nby str[fp]time.\u00a0 The default value is \"@GMT-%Y.%m.%d-%H.%M.%S\".\r\n\r\nshadow:localtime = yes\/no (default is no)\r\n\r\nThis is an optional parameter that indicates whether the\r\nsnapshot names are in UTC\/GMT or the local time.<\/pre>\n<p>Example usage with ZFS for the <code>[homes]<\/code> share is:<\/p>\n<pre>[homes]\r\n   comment = Home Directories\r\n   browseable = no\r\n   writable = yes\r\n   vfs objects = shadow_copy2\r\n   shadow: snapdir = .zfs\/snapshot\r\n   shadow: sort = desc\r\n   shadow: localtime = yes\r\n   shadow: format = %Y%m%d-%H%M%S<\/pre>\n<p>Where the snapshots would be taken with:<\/p>\n<pre># zfs snapshot -r tank\/home@`date +%Y%m%d-%H%M%S`<\/pre>\n<p>Recent versions of OpenSolaris allow ZFS snapshots to be created remotely over SMB\/CIFS by simply creating a directory in the <code>.zfs\/snapshot<\/code> subdirectory.\u00a0 To see how this can be used, see my <a href=\"http:\/\/www.edplese.com\/blog\/2009\/11\/18\/windows-backups-to-zfs\/\">Windows Backups to ZFS<\/a> post.\u00a0 Though referring to the SMB\/CIFS server built into OpenSolaris, the concept works equally as well with Samba and the shadow copy patch.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A few weeks ago there was a thread on the Samba mailing list regarding some difficulties in getting my shadow copy patches to work with newer versions of Samba.\u00a0\u00a0These patches were originally written for Samba 3.0.25, and since then, Samba has moved up to version 3.4.3, with the 3.5.0 release on the horizon.\u00a0 The more [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[9,5],"_links":{"self":[{"href":"https:\/\/www.edplese.com\/blog\/wp-json\/wp\/v2\/posts\/97"}],"collection":[{"href":"https:\/\/www.edplese.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.edplese.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.edplese.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.edplese.com\/blog\/wp-json\/wp\/v2\/comments?post=97"}],"version-history":[{"count":16,"href":"https:\/\/www.edplese.com\/blog\/wp-json\/wp\/v2\/posts\/97\/revisions"}],"predecessor-version":[{"id":112,"href":"https:\/\/www.edplese.com\/blog\/wp-json\/wp\/v2\/posts\/97\/revisions\/112"}],"wp:attachment":[{"href":"https:\/\/www.edplese.com\/blog\/wp-json\/wp\/v2\/media?parent=97"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.edplese.com\/blog\/wp-json\/wp\/v2\/categories?post=97"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.edplese.com\/blog\/wp-json\/wp\/v2\/tags?post=97"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}