{"id":1298,"date":"2024-01-27T02:22:34","date_gmt":"2024-01-27T01:22:34","guid":{"rendered":"https:\/\/nefarius.at\/?p=1298"},"modified":"2024-01-27T15:36:18","modified_gmt":"2024-01-27T14:36:18","slug":"the-correct-way-to-expand-the-microsd-card-root-partition-for-openwrt","status":"publish","type":"post","link":"https:\/\/nefarius.at\/2024\/01\/27\/the-correct-way-to-expand-the-microsd-card-root-partition-for-openwrt\/","title":{"rendered":"The correct way to expand the MicroSD card root partition for OpenWrt"},"content":{"rendered":"\n

I recently purchased a FriendlyARM NanoPi R4S<\/a> I plan to use as a router in a project I plan to blog about later on, so I downloaded the firmware image<\/a> and flashed it onto the 64 GB MicroSD card using balenaEtcher<\/a>. Although being very simple and convenient, the main disadvantage with using these prepared images is the static and way too small root partition size. Took a bit of searching to find the instructions that actually work<\/a>, so here they are.<\/p>\n\n\n\n

Log into your OpenWrt instance via SSH and install these prerequisites:<\/p>\n\n\n\n

opkg update\nopkg install parted losetup resize2fs<\/code><\/pre>\n\n\n\n

Now you can download and execute a helper script which will add the expansion to 100% free space on next boot:<\/p>\n\n\n\n

wget -U \"\" -O expand-root.sh \"https:\/\/openwrt.org\/_export\/code\/docs\/guide-user\/advanced\/expand_root?codeblock=0\"\n. .\/expand-root.sh<\/code><\/pre>\n\n\n\n

Now reboot the device whenever convenient and afterwards you should see tons of new space using df -h<\/code> command:<\/p>\n\n\n\n

Filesystem                Size      Used Available Use% Mounted on\n\/dev\/root                58.7G    219.7M     58.4G   0% \/\ntmpfs                     1.9G      1.0M      1.9G   0% \/tmp\ntmpfs                   512.0K         0    512.0K   0% \/dev\n\/dev\/root                58.7G    219.7M     58.4G   0% \/opt\/docker<\/code><\/pre>\n\n\n\n

EDIT:<\/strong> these instructions<\/a> in the related repository didn’t work for me.<\/p>\n","protected":false},"excerpt":{"rendered":"

I recently purchased a FriendlyARM NanoPi R4S I plan to use as a router in a project I plan to blog about […]<\/p>\n","protected":false},"author":2,"featured_media":1302,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[17,16],"_links":{"self":[{"href":"https:\/\/nefarius.at\/wp-json\/wp\/v2\/posts\/1298"}],"collection":[{"href":"https:\/\/nefarius.at\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nefarius.at\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nefarius.at\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/nefarius.at\/wp-json\/wp\/v2\/comments?post=1298"}],"version-history":[{"count":4,"href":"https:\/\/nefarius.at\/wp-json\/wp\/v2\/posts\/1298\/revisions"}],"predecessor-version":[{"id":1303,"href":"https:\/\/nefarius.at\/wp-json\/wp\/v2\/posts\/1298\/revisions\/1303"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nefarius.at\/wp-json\/wp\/v2\/media\/1302"}],"wp:attachment":[{"href":"https:\/\/nefarius.at\/wp-json\/wp\/v2\/media?parent=1298"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nefarius.at\/wp-json\/wp\/v2\/categories?post=1298"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nefarius.at\/wp-json\/wp\/v2\/tags?post=1298"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}