{"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 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 Now reboot the device whenever convenient and afterwards you should see tons of new space using opkg update\nopkg install parted losetup resize2fs<\/code><\/pre>\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
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