{"id":408,"date":"2016-05-22T08:44:30","date_gmt":"2016-05-22T00:44:30","guid":{"rendered":"http:\/\/www.lanchbury.id.au\/?p=408"},"modified":"2016-05-22T08:44:30","modified_gmt":"2016-05-22T00:44:30","slug":"squeezing-a-automanaged-drive","status":"publish","type":"post","link":"https:\/\/www.lanchbury.au\/?p=408","title":{"rendered":"Squeezing A Automanaged Drive"},"content":{"rendered":"<p>So I run MythTV, and when I rebuild\/transferred all my recordings to my new server I gave it an extra 0.3TB space, giving it a total of 1.3TB.  Well a few months on I&#8217;m regretting my decision.<\/p>\n<p>So looking into deleting recordings, and then freeing the space seemed like a massive job, so instead I&#8217;ve written some code to consume hard drive space at a 1GB per 6 hours (4GB per day) to force the inbuilt recording management to delete the old recording faster for me.<\/p>\n<p>Yeah okay it&#8217;ll take 3 months to make the space, but it only took me an hour to write this, compared to fighting for weeks with new recordings taking space that I&#8217;ve freed.<\/p>\n<p>Hopefully it can help you too somewhere, if you&#8217;ve found and will use it shout out, be interesting to hear how it helped.<br \/>\n<code><br \/>\n#!\/bin\/sh<\/p>\n<p># This script is running daily to squeeze the myth storage group<br \/>\n#  smaller so I can get it to fit on a 1TB HDD again.<br \/>\n#  I really don't feel like myth really needs that much storage for recordings<\/p>\n<p>INCREASINGFILE=\/mnt\/storage\/increasingfile<br \/>\nCURRENTSIZE=$(ls -lt \/mnt\/storage\/increasingfile | awk '{print $5}')<br \/>\nMAXSIZE=422592708000<br \/>\nMAXSIZEGB=$(($MAXSIZE \/ 1073741824))<br \/>\nINCREMENT=1073741824<br \/>\nINCREMENTGB=$(($INCREMENT \/ 1073741824))<\/p>\n<p>CURRENTSIZEGB=$(($CURRENTSIZE \/ 1073741824))<\/p>\n<p>echo $INCREASINGFILE is at $CURRENTSIZEGB GB of $MAXSIZEGB GB<\/p>\n<p>if [ \"$CURRENTSIZE\" -le \"$MAXSIZE\" ]<br \/>\n  then<br \/>\n    INCREASE=$(($CURRENTSIZE + $INCREMENT))<br \/>\n    INCREASEGB=$(($INCREASE \/ 1073741824))<br \/>\n    echo Increasing a further $INCREMENTGB GB totalling $INCREASEGB GB<br \/>\n    fallocate \/mnt\/storage\/increasingfile -l $INCREASE<br \/>\n  else<br \/>\n    echo \"Script has hit $MAXSIZE ($MAXSIZEGB GB) maximium, stopping.\"<br \/>\nfi<br \/>\n<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>So I run MythTV, and when I rebuild\/transferred all my recordings to my new server I gave it an extra 0.3TB space, giving it a total of 1.3TB. Well a few months on I&#8217;m regretting my decision. So looking into deleting recordings, and then freeing the space seemed like a massive job, so instead I&#8217;ve &hellip; <\/p>\n<p><a class=\"more-link btn\" href=\"https:\/\/www.lanchbury.au\/?p=408\">Continue reading<\/a><\/p>\n","protected":false},"author":2,"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":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[12,6],"tags":[],"class_list":["post-408","post","type-post","status-publish","format-standard","hentry","category-how-to","category-support","item-wrap"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p7tC7P-6A","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/www.lanchbury.au\/index.php?rest_route=\/wp\/v2\/posts\/408","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.lanchbury.au\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.lanchbury.au\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.lanchbury.au\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.lanchbury.au\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=408"}],"version-history":[{"count":3,"href":"https:\/\/www.lanchbury.au\/index.php?rest_route=\/wp\/v2\/posts\/408\/revisions"}],"predecessor-version":[{"id":412,"href":"https:\/\/www.lanchbury.au\/index.php?rest_route=\/wp\/v2\/posts\/408\/revisions\/412"}],"wp:attachment":[{"href":"https:\/\/www.lanchbury.au\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=408"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.lanchbury.au\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=408"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.lanchbury.au\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=408"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}