{"id":13756,"date":"2019-04-06T02:16:10","date_gmt":"2019-04-06T02:16:10","guid":{"rendered":"http:\/\/www.appservgrid.com\/paw92\/?p=13756"},"modified":"2019-04-06T02:16:10","modified_gmt":"2019-04-06T02:16:10","slug":"how-to-delete-huge-100-200gb-files-in-linux","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/04\/06\/how-to-delete-huge-100-200gb-files-in-linux\/","title":{"rendered":"How to Delete HUGE (100-200GB) Files in Linux"},"content":{"rendered":"<p>Usually, to\u00a0<a href=\"https:\/\/www.tecmint.com\/permanently-and-securely-delete-files-directories-linux\/\" target=\"_blank\" rel=\"noopener noreferrer\">delete\/remove a file from Linux terminal<\/a>, we use the rm command (delete files), shred command (securely delete a file), wipe command (securely erase a file) or secure-deletion toolkit (a collection of\u00a0<a href=\"https:\/\/www.tecmint.com\/permanently-and-securely-delete-files-directories-linux\/\" target=\"_blank\" rel=\"noopener noreferrer\">secure file deletion tools<\/a>).<\/p>\n<p>We can use any of the above utilities to deal with relatively small files. What if we want to delete\/remove a huge file\/directory say of about\u00a0<strong>100-200GB<\/strong>. This may not be as easy as it seems, in terms of the time taken to remove the file (I\/O scheduling) as well as the amount of RAM consumed while carrying out the operation.<\/p>\n<p>In this tutorial, we will explain how to efficiently and reliably delete huge files\/directories in Linux.<\/p>\n<p><b>Suggested Read:<\/b>\u00a0<a href=\"https:\/\/www.tecmint.com\/empty-delete-file-content-linux\/\" target=\"_blank\" rel=\"noopener noreferrer\">5 Ways to Empty or Delete a Large File Content in Linux<\/a><\/p>\n<p>The main aim here is to use a technique that will not slow down the system while removing a huge file, resulting to reasonable I\/O. We can achieve this using the\u00a0<strong>ionice command<\/strong>.<\/p>\n<h3>Deleting HUGE (200GB) Files in Linux Using ionice Command<\/h3>\n<p><strong>ionice<\/strong>\u00a0is a useful program which sets or gets the I\/O scheduling class and priority for another program. If no arguments or just\u00a0<code>-p<\/code>\u00a0is given, ionice will query the current I\/O scheduling class and priority for that process.<\/p>\n<p>If we give a command name such as\u00a0<strong>rm command<\/strong>, it will run this command with the given arguments. To specify the\u00a0<a href=\"https:\/\/www.tecmint.com\/find-linux-processes-memory-ram-cpu-usage\/\" target=\"_blank\" rel=\"noopener noreferrer\">process IDs of running processes<\/a>\u00a0for which to get or set the scheduling parameters, run this:<\/p>\n<pre># ionice -p PID\r\n<\/pre>\n<p>To specify the name or number of the scheduling class to use (<strong>0<\/strong>\u00a0for none,\u00a0<strong>1<\/strong>\u00a0for real time,\u00a0<strong>2<\/strong>\u00a0for best-effort,\u00a0<strong>3<\/strong>\u00a0for idle) the command below.<\/p>\n<p>This means that\u00a0<strong>rm<\/strong>\u00a0will belong to idle I\/O class and only uses I\/O when any other process does not need it:<\/p>\n<pre><strong>---- Deleting Huge Files in Linux -----<\/strong>\r\n# ionice -c 3 rm \/var\/logs\/syslog\r\n# ionice -c 3 rm -rf \/var\/log\/apache\r\n<\/pre>\n<p>If there won\u2019t be much idle time on the system, then we may want to use the best-effort scheduling class and set a low priority like this:<\/p>\n<pre># ionice -c 2 -n 6 rm \/var\/logs\/syslog\r\n# ionice -c 2 -n 6 rm -rf \/var\/log\/apache\r\n<\/pre>\n<p><strong>Note<\/strong>: To delete huge files using a secure method, we may use the\u00a0<strong>shred<\/strong>,\u00a0<strong>wipe<\/strong>\u00a0and various tools in the secure-deletion toolkit mentioned earlier on, instead of\u00a0<strong>rm command<\/strong>.<\/p>\n<p><b>Suggested Read:<\/b>\u00a0<a href=\"https:\/\/www.tecmint.com\/permanently-and-securely-delete-files-directories-linux\/\" target=\"_blank\" rel=\"noopener noreferrer\">3 Ways to Permanently and Securely Delete Files\/Directories\u2019 in Linux<\/a><\/p>\n<p>For more info, look through the ionice man page:<\/p>\n<pre># man ionice \r\n<\/pre>\n<p>That\u2019s it for now! What other methods do you have in mind for the above purpose? Use the comment section below to share with us.<\/p>\n<p><a href=\"https:\/\/www.tecmint.com\/delete-huge-files-in-linux\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Usually, to\u00a0delete\/remove a file from Linux terminal, we use the rm command (delete files), shred command (securely delete a file), wipe command (securely erase a file) or secure-deletion toolkit (a collection of\u00a0secure file deletion tools). We can use any of the above utilities to deal with relatively small files. What if we want to delete\/remove &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/04\/06\/how-to-delete-huge-100-200gb-files-in-linux\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;How to Delete HUGE (100-200GB) Files in Linux&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-13756","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/13756","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=13756"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/13756\/revisions"}],"predecessor-version":[{"id":13757,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/13756\/revisions\/13757"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=13756"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=13756"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=13756"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}