OpenWrt Forum Archive

Topic: merge root with sdcard directory

The content of this topic has been archived on 27 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hello,

I was wondering if it's possible to merge my existing root directory with an sdcard.

root@iobot-0012:/mnt/sdb1# df -h
Filesystem                Size      Used Available Use% Mounted on
rootfs                    1.3M    980.0K    364.0K  73% /
/dev/root                13.5M     13.5M         0 100% /rom
tmpfs                    30.1M    116.0K     30.0M   0% /tmp
/dev/mtdblock4            1.3M    980.0K    364.0K  73% /overlay
overlayfs:/overlay        1.3M    980.0K    364.0K  73% /
tmpfs                   512.0K         0    512.0K   0% /dev
/dev/sda1                14.4G     36.9M     13.6G   0% /sdcard1

So, I guess what I'm asking for is to extend my rootfs directory with "sdcard1". Is this possible or will I have to completely move rootfs onto the sd card?

Thanks

You can mount it anywhere you want, but to make it fully a part of rootfs I don't think so without using lvm you can't span disks.

but if for example you have a bunch of stuff in /home/blah you can certainly move the stuff to /sdcard1 then mount it under /home/blah

but if for example you have a bunch of stuff in /home/blah you can certainly move the stuff to /sdcard1 then mount it under /home/blah

What is this method called, simply mounting? You see, my main issue currently is where my packages are being installed, which happens to be in /dev/mtdblock4. It is rapidly running out of space. All these packages are installed during image building. So, I am not sure if I can have all these packages installed onto the sd card by default, during the image installation itself.

So, the alternate idea was to try to "extend" the already allocated space into the sdcard somehow. Seamlessly adding more space, which I guess is not possible.

By doing what you are suggesting, would it be possible to move all of /bin or all of /etc onto the sdcard, then mount it under the original /bin /etc path?

I have already tried the extroot method, but I run out of space while I am copying over root onto sdcard.

yes, but you'd still need any files required to boot to be left in /etc/ or /bin/ so i'm not sure how much you'd gain.  It would be better to choose a mount point that isn't needed for booting.

its basically the same thing extroot is doing, the real root is used until the system boots and the drivers to access the external storage are in memory, then mount over the top of it and then install the additional packages you need.

Not sure how it is possible to run out of space on a 16gb sd card......

WWTK wrote:

Not sure how it is possible to run out of space on a 16gb sd card......

If you tried to copy stuff like /dev/zero, which is an endless supply of zeros.

mk24 wrote:
WWTK wrote:

Not sure how it is possible to run out of space on a 16gb sd card......

If you tried to copy stuff like /dev/zero, which is an endless supply of zeros.

Yeah but you'd run out of inodes way before space

Thanks for the replies.

Well the issue isn't that I'm running out of space on the sd card, it's that I'm running out of space on root.

Is it possible, when I'm flashing my router with a new image, to download all the packages that were selected from "make menuconfig" to be installed on the sd card to begin with? That would solve my issue 100%.

supergeen wrote:

Thanks for the replies.

Well the issue isn't that I'm running out of space on the sd card, it's that I'm running out of space on root.

Is it possible, when I'm flashing my router with a new image, to download all the packages that were selected from "make menuconfig" to be installed on the sd card to begin with? That would solve my issue 100%.

when you make your config, you should make it just bare bones enough to boot and include the drivers needed for your sdcard and the stuff (like block-mount kmod-fs-ext4 kmod-usb-storage e2fsprogs kmod-usb-ohci kmod-usb-uhci fdisk) to create the filesystem

then use the extroot proceedure starting at "common second stage" here:

https://lede-project.org/docs/user-guid … cond_stage

that is by far the best solution for you, you said you ran out of room on the sdcard when you tried to do that which shouldn't be possible because /overlay is no where near 16gb, thats where the other comments came from.

after you have the extroot set up then you can install packages to your hearts content...

(Last edited by WWTK on 22 Nov 2017, 02:08)

The discussion might have continued from here.