{"id":55,"date":"2009-10-04T11:15:00","date_gmt":"2009-10-04T09:15:00","guid":{"rendered":"http:\/\/www.hauweele.net\/~gawen\/blog\/?p=55"},"modified":"2014-05-12T19:44:24","modified_gmt":"2014-05-12T17:44:24","slug":"howto-save-a-lot-of-disk-space-on-nokia-n810","status":"publish","type":"post","link":"https:\/\/hauweele.net\/~gawen\/blog\/?p=55","title":{"rendered":"Howto save a lot of disk space on nokia N810"},"content":{"rendered":"<p>The Nokia N810 is an internet tablet (not a phone though it can communicate with cellular phone via bluetooth). It&#8217;s a nice small device which run the <span style=\"font-style: italic;\">Maemo Distribution<\/span> which seems to be based on <span style=\"font-style: italic;\">Debian<\/span> since it uses the Debian Package Manager. But the distribution&#8217;s structure really feels like an embedded device and this is quite annoying when you try to optimize this device.<br \/>One thing which is really boring is the lack of disk space on the device.&nbsp;Actually the device use two miniSD (MMC) cards for personnal documents, images, videos and so on and a 256MB MTD using a JFFS2 compressed file system to store the whole distribution which means every package and their data files which takes a large amount of disk space and even so much that the MTD can easily be completely filled with a few apps.<br \/>The basic idea to save some disk space is to move some part of the MTD on the MMC primarely reformated from <span style=\"font-style: italic;\">vfat<\/span> to <span style=\"font-style: italic;\">ext2<\/span>. Many articles explain how to move stuff like <span style=\"font-style: italic;\">\/var\/cache <\/span>and others using symlinks which can save you about 20MB. But they also explain that you can&#8217;t do that with <span style=\"font-style: italic;\">\/usr\/share\/<\/span> for example since it will break the boot process. Indeed the boot process depends on many stuff located in <span style=\"font-style: italic;\">\/usr\/share<\/span> and thus if the MMC are not mounted while boot occurs the system will just stall waiting for an hard reset to get everything right and clean again. Here comes a way to go around this :<\/p>\n<p>As root we check the run level :<\/p>\n<blockquote><p><span style=\"font-family: courier new; font-size: 85%;\"><span style=\"color: #660000;\">Nokia-N810-43-7:~# runlevel<\/span><br \/><span style=\"color: #660000;\">N 2<\/span><\/span><\/p><\/blockquote>\n<p><span style=\"font-family: courier new; font-size: 85%;\"><span style=\"color: #660000;\"><\/span><\/span>We see we are in runlevel 2. Let&#8217;s check how the boot process arranges itself in that runlevel :<br \/><span style=\"font-family: courier new; font-size: 85%;\"><span style=\"color: #660000;\"><\/span><\/span><\/p>\n<blockquote><p><span style=\"font-family: courier new; font-size: 85%;\"><span style=\"color: #660000;\">Nokia-N810-43-7:~# ls \/etc\/rc2.d<\/span><br \/><span style=\"color: #660000;\">K00zzinitdone<\/span><br \/><span style=\"color: #660000;\">S12fb-progress.sh<\/span><br \/><span style=\"color: #660000;\">S20dbus<\/span><br \/><span style=\"color: #660000;\">S20hal<\/span><br \/><span style=\"color: #660000;\">S20osso-applet-display<\/span><br \/><span style=\"color: #660000;\">S21mce<\/span><br \/><span style=\"color: #660000;\">(&#8230;)<\/span><\/span><\/p><\/blockquote>\n<p>It looks like <span style=\"font-style: italic;\">fb-progress.sh <\/span>is the first script executed in the boot process.<span style=\"font-style: italic;\"><\/span> So we edit this script (<span style=\"font-style: italic;\">\/etc\/init.d\/fb-progress.sh<\/span>) and add the following line at the beginning of the script (line 19 or so):<\/p>\n<blockquote><p><span style=\"font-family: courier new; font-size: 85%;\"><span style=\"color: #000066;\">\/usr\/sbin\/osso-mmc-mount.sh \/dev\/mmcblk0p1 \/media\/mmc2<\/span><br \/><span style=\"color: #000066;\">\/usr\/sbin\/osso-mmc-mount.sh \/dev\/mmcblk1p1 \/media\/mmc1<\/span><\/span><\/p><\/blockquote>\n<p>So we know that MMC will be mounted at first in the boot process. After that scripts which need <span style=\"font-style: italic;\">share <\/span>stuff or other may look on the MMC since we know they were already mounted. Then we move things like <span style=\"font-style: italic;\">\/usr\/share<\/span> on the MMC :<br \/><span style=\"font-family: courier new; font-size: 85%;\"><span style=\"color: #660000;\"><\/span><\/span><\/p>\n<blockquote><p><span style=\"font-family: courier new; font-size: 85%;\"><span style=\"color: #660000;\">Nokia-N810-43-7:~# mkdir \/media\/mmc1\/.usr<\/span><br \/><span style=\"color: #660000;\">Nokia-N810-43-7:~# cp -aR \/usr\/share \/media\/mmc1\/.usr<\/span><br \/><span style=\"color: #660000;\">Nokia-N810-43-7:~# rm -rf \/usr\/share<br \/>Nokia-N810-43-7:~# ln -s \/media\/mmc1\/.usr\/share \/usr\/share<\/span><\/span><\/p><\/blockquote>\n<p>Of course the same could be done for other directory. Here is the list of directory that I switched from MTD to MMC without breaking the boot process :<\/p>\n<ul>\n<li><span style=\"font-size: 85%;\">\/var\/backups<\/span><\/li>\n<li><span style=\"font-size: 85%;\">\/var\/cache<\/span><\/li>\n<li><span style=\"font-size: 85%;\">\/usr\/local<\/span><\/li>\n<li><span style=\"font-size: 85%;\">\/usr\/share<\/span><\/li>\n<li><span style=\"font-size: 85%;\">\/usr\/bin<\/span><\/li>\n<li><span style=\"font-size: 85%;\">\/usr\/games<\/span><\/li>\n<li><span style=\"font-size: 85%;\">\/usr\/lib<\/span><\/li>\n<li><span style=\"font-size: 85%;\">\/home\/user<\/span><\/li>\n<\/ul>\n<p>The <span style=\"font-style: italic;\">df<\/span> entry for the MTD follow :<br \/><span style=\"font-family: courier new; font-size: 85%;\"><span style=\"color: #006600;\"><\/span><\/span><\/p>\n<blockquote><p><span style=\"font-family: courier new; font-size: 85%;\"><span style=\"color: #006600;\">Filesystem       Size     Used    Available   Use%   Mounted on<\/span><br \/><span style=\"color: #006600;\">\/dev\/mtdblock4   249.5M   16.8M   232.7M      7%     \/<\/span><\/span><\/p><\/blockquote>\n<p>And it almost never grow when apps are installed.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Nokia N810 is an internet tablet (not a phone though it can communicate with cellular phone via bluetooth). It&#8217;s a nice small device which run the Maemo Distribution which seems to be based on Debian since it uses the &hellip; <a href=\"https:\/\/hauweele.net\/~gawen\/blog\/?p=55\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[235,6,238,234,236,239,237,146],"class_list":["post-55","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-disk","tag-linux","tag-maemo","tag-n810","tag-nokia","tag-os2008","tag-save","tag-space"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=\/wp\/v2\/posts\/55","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=55"}],"version-history":[{"count":0,"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=\/wp\/v2\/posts\/55\/revisions"}],"wp:attachment":[{"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=55"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=55"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hauweele.net\/~gawen\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=55"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}