{"id":331,"date":"2009-02-25T00:54:56","date_gmt":"2009-02-24T22:54:56","guid":{"rendered":"http:\/\/www.lucas-nussbaum.net\/blog\/?p=331"},"modified":"2009-02-25T00:54:56","modified_gmt":"2009-02-24T22:54:56","slug":"creating-a-large-file-without-zeroing-it","status":"publish","type":"post","link":"https:\/\/www.lucas-nussbaum.net\/blog\/?p=331","title":{"rendered":"Creating a large file without zeroing it"},"content":{"rendered":"<p>Dear readers,<\/p>\n<p>I&#8217;d like to use a large file (> 10 GB) as swap space.<br \/>\nThe required steps are:<\/p>\n<ol>\n<li>Create a file<\/li>\n<li>mkswap $file<\/li>\n<li>swapon $file<\/li>\n<\/ol>\n<p>Now, how can I create the file? The obvious and fast solution is to create a file with holes:<br \/>\n<code>dd if=\/dev\/zero of=foo bs=1M count=1 seek=10239<\/code><br \/>\n<code>mkswap<\/code> works, but <code>swapon<\/code> complains:<br \/>\n<code># swapon \/tmp\/foo<br \/>\nswapon: Skipping file \/tmp\/foo - it appears to have holes.<\/code><\/p>\n<p>Of course, I count just <code>dd if=\/dev\/zero of=foo bs=1M count=10240<\/code>, but that takes too long for me.<\/p>\n<p>So, question: is there a way to tell the system: <b>create a file that is 10GB big, don&#8217;t but fill it with zeros?<\/b><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Dear readers, I&#8217;d like to use a large file (> 10 GB) as swap space. The required steps are: Create a file mkswap $file swapon $file Now, how can I create the file? The obvious and fast solution is to create a file with holes: dd if=\/dev\/zero of=foo bs=1M count=1 seek=10239 mkswap works, but swapon [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"0","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[],"class_list":["post-331","post","type-post","status-publish","format-standard","hentry","category-planetdebian"],"_links":{"self":[{"href":"https:\/\/www.lucas-nussbaum.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/331","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.lucas-nussbaum.net\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.lucas-nussbaum.net\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.lucas-nussbaum.net\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.lucas-nussbaum.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=331"}],"version-history":[{"count":0,"href":"https:\/\/www.lucas-nussbaum.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/331\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.lucas-nussbaum.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=331"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.lucas-nussbaum.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=331"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.lucas-nussbaum.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=331"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}