{"id":69,"date":"2008-08-19T19:59:10","date_gmt":"2008-08-20T00:59:10","guid":{"rendered":"http:\/\/yourlinuxguy.com\/?p=69"},"modified":"2008-08-19T20:05:27","modified_gmt":"2008-08-20T01:05:27","slug":"how-do-i-stop-my-gzipped-backups-from-taking-too-much-space","status":"publish","type":"post","link":"https:\/\/yourLinuxGuy.com\/?p=69","title":{"rendered":"How do I stop my gzipped backups from taking too much space?"},"content":{"rendered":"<p>This question came to me from Rune (his question is edited for brevity):<\/p>\n<p><em>I&#8217;ve got a SLES 9.3 system where the users are using gzip to compress their daily online DB backups. It&#8217;s scripted, but basically it goes something like this:<\/em><\/p>\n<p><em># dbbackup db1 \/scratch\/outputfile1<br \/>\n# gzip \/scratch\/outputfile1<br \/>\n# dbbackup db1 \/scratch\/outputfile2<br \/>\n# gzip \/scratch\/outputfile2 <\/em><\/p>\n<p><em>[&#8230;He goes on to explain that the backup fills up the filesystem, especially since some aspect of the process\/filesystem is holding on to the space long after the db output&#8230;.]<\/em><\/p>\n<p><em>Do you know if this is expected behavior for gzip? [&#8230;]<br \/>\n<\/em><\/p>\n<p>Yes, that can be normal, but it isn&#8217;t <code>gzip<\/code>&#8216;s fault. It could be the filesystem and kernel together, and could be the storage system you use (you didn&#8217;t mention if it is a SAN, but it sure sounds like it could be SAN behavior). The space is allocated as needed, but cleanup routines run to clear the actual space later. That&#8217;s pretty low-level stuff, and I don&#8217;t want to get into it here&#8230; especially since I don&#8217;t know the specifics without researching it&#8230; \ud83d\ude09<\/p>\n<p>One way to avoid the whole problem though, is to dump the database backup output inline into <code>gzip<\/code>; instead of making the file, and *then* zipping it. That way, the only space that is allocated is the space needed the first time. You don&#8217;t end up having waiting for a cleanup after the export and before the <code>gzip<\/code>.<\/p>\n<p>I&#8217;m glad you included your script element so I could offer a suggestion&#8230; try this:<\/p>\n<p><code>dbbackup db1 |gzip &gt; \/scratch\/outputfile1.zip<\/code><\/p>\n<p>&#8230;hope that helps!<\/p>\n<p>\ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This question came to me from Rune (his question is edited for brevity): I&#8217;ve got a SLES 9.3 system where the users are using gzip to compress their daily online DB backups. It&#8217;s scripted, but basically it goes something like&#8230;<br \/><a class=\"read-more-button\" href=\"https:\/\/yourLinuxGuy.com\/?p=69\">Read more<\/a><\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[49,11,47],"tags":[],"class_list":["post-69","post","type-post","status-publish","format-standard","hentry","category-gzip","category-intermediate","category-linuxgeneral"],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pnjn1-17","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/yourLinuxGuy.com\/index.php?rest_route=\/wp\/v2\/posts\/69","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/yourLinuxGuy.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/yourLinuxGuy.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/yourLinuxGuy.com\/index.php?rest_route=\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/yourLinuxGuy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=69"}],"version-history":[{"count":5,"href":"https:\/\/yourLinuxGuy.com\/index.php?rest_route=\/wp\/v2\/posts\/69\/revisions"}],"predecessor-version":[{"id":73,"href":"https:\/\/yourLinuxGuy.com\/index.php?rest_route=\/wp\/v2\/posts\/69\/revisions\/73"}],"wp:attachment":[{"href":"https:\/\/yourLinuxGuy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=69"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/yourLinuxGuy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=69"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/yourLinuxGuy.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=69"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}