{"id":640,"date":"2012-07-10T16:46:17","date_gmt":"2012-07-10T08:46:17","guid":{"rendered":"http:\/\/rmohan.com\/?p=640"},"modified":"2012-07-10T16:46:17","modified_gmt":"2012-07-10T08:46:17","slug":"creating-large-empty-files-in-linux-unix","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=640","title":{"rendered":"Creating large empty files in Linux \/ UNIX"},"content":{"rendered":"<h3>Creating large empty files in Linux \/ UNIX<\/h3>\n<p align=\"center\"><span style=\"text-decoration: underline;\">To create large empty files in Linux or UNIX:<\/span><\/p>\n<p><strong># dd if=\/dev\/zero of=filename bs=1024 count=desired<\/strong><\/p>\n<p><strong>Example to create a 1GB file:<br \/>\n<\/strong><br \/>\ndd if=\/dev\/zero of=file_1GB bs=1024 count=1000<br \/>\n\/or\/<br \/>\ndd if=\/dev\/zero of=file_1GB bs=4096 count=250<br \/>\n\/or\/<br \/>\ndd if=\/dev\/zero of=file_1GB bs=2048 count=500<\/p>\n<p><strong>Example to create a 2GB file:<\/strong><\/p>\n<p>dd if=\/dev\/zero of=file_2GB bs=2048 count=1000<br \/>\n\/or\/<br \/>\ndd if=\/dev\/zero of=file_2GB bs=1024 count=2000<\/p>\n<p><strong>Example to create a 512MB file:<\/strong><\/p>\n<p>dd if=\/dev\/zero of=file_512MB bs=1024 count=500<br \/>\n\/or\/<br \/>\ndd if=\/dev\/zero of=file_1GB bs=512 count=1000<\/p>\n<p><em><strong>either use<\/strong><\/em><\/p>\n<p><strong># mkfile size myfile<br \/>\n<\/strong><br \/>\nwhere can be in KB, MB or GB using k, m or g as suffix. To create a 10 GB file, use<\/p>\n<p><strong># mkfile 10240m myfile<\/strong><\/p>\n<p>If you run # mkfile -n 10240m myfile the file will be created, but the disk blocks will not get allocated, only when writing data into the file.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>Posted by Satish LN at <a title=\"permanent link\" href=\"http:\/\/lokams.blogspot.sg\/2008\/04\/creating-large-empty-files-in-linux.html\" rel=\"bookmark\"><abbr title=\"2008-04-19T20:46:00+04:00\">8:46 PM<\/abbr><\/a> <a title=\"Email Post\" href=\"http:\/\/www.blogger.com\/email-post.g?blogID=2474579806767004724&amp;postID=587521860796573368\"> <img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/img1.blogblog.com\/img\/icon18_email.gif\" alt=\"\" width=\"18\" height=\"13\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Creating large empty files in Linux \/ UNIX <\/p>\n<p align=\"center\">To create large empty files in Linux or UNIX:<\/p>\n<p># dd if=\/dev\/zero of=filename bs=1024 count=desired<\/p>\n<p>Example to create a 1GB file: dd if=\/dev\/zero of=file_1GB bs=1024 count=1000 \/or\/ dd if=\/dev\/zero of=file_1GB bs=4096 count=250 \/or\/ dd if=\/dev\/zero of=file_1GB bs=2048 count=500<\/p>\n<p>Example to create a 2GB file:<\/p>\n<p>dd if=\/dev\/zero [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/640"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=640"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/640\/revisions"}],"predecessor-version":[{"id":641,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/640\/revisions\/641"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=640"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=640"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=640"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}