OpenWrt Forum Archive

Topic: Boot from external storage with block-extroot w/o building an image

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

1. Install the jffs2 version for your router model. Squashfs won't work whitout building an image.


2. Install packets for your storage device and your filesystem

opkg update
opkg install kmod-usb-core kmod-usb-uhci kmod-usb-storage  kmod-usb2  kmod-fs-ext3

(This is for ext3 filesystem on usb2 device. Try kmod-usb-ohci if kmod-usb-uhci doesn't work for you)


3. Reboot your router

reboot

4. Copy the Filesystem to your external storage

mount /dev/sda2 /mnt
mkdir /tmp/root
mount -o bind / /tmp/root
cp /tmp/root/* /mnt -a
umount /tmp/root
umount /mnt

(Change /dev/sda2 to your external storage device)


Optional: You may want to add a footline at the bottom of your login banner located in /etc/banner (on the internal rom). This allows you to recognize whenever openwrt booted from the internal rom

echo Booted from internal rom >> /etc/banner

5. Add a mount section with option is_rootfs 1 for your storage device in /etc/config/fstab

config mount
        option target   /mnt
        option device   /dev/sda2
        option fstype   ext3
        option options  rw,sync
        option enabled  1
        option enabled_fsck 1
        option is_rootfs 1

(Change option device   /dev/sda2 according to your storage device. Target option is disregarded with is_rootfs 1)


6. Install packet block-extroot

opkg update
opkg install block-extroot

7. Reboot your router and verify that openwrt recognized your external storage partition. /overlay should have been mounted at /overlay, just compare the size of /overlay with the size of your external storage

df -h

8. Add option force_space in /etc/opkg.conf to allow installation of packets bigger than your /rom partitions free space

echo option force_space >> /etc/opkg.conf

Tested on Backfire but should work on Kamikaze too

devnullfast wrote:

1. Install the jffs2 version for your router model. Squashfs won't work whitout building an image.

It is not recommended to use the jffs2 image...

It is not recommended to use the jffs2 image...

Why not?
Does this concern every openwrt distribution?

I am running Openwrt with jffs2 image booted from external storage on different platforms for about a year without any problems.


Using jffs2 is the only way to boot openwrt from external storage with block-extroot without compiling an image...

Wlan with kamikaze installed on ar71xx worked with a snapshot from january 2010. It is broken in later builds what caused me to switch to Backfire, where wlan on ar71xx is working (on jffs2) without any problem.

The first time i tried to compile images for openwrt backfire to be able to fix problems myself i couldn't find backfire image buidling tools. Second time i couldn't find backfire sdk to what every openwrt howto about building images was pointing to. That is what caused me to install jffs2 and finally having a working router with external rootfs and every packet needed installed and running stable  .

I found information about why block-extroot has to be compiled in the image on Squashfs build but never why it isn't recommended to use jffs2 images, so please give reasons for your statement.

Your statement is the same as the statements from Hardware Manufacturers who communicate that an installation of an open source firmware release other than the one from their support website isn't recommended or that the router's warranty would end after such a firmware has been installed to the device for every Openwrt-newby like me whitout substantiation.

Thank you for your tip! The only problem I found is that after that I cannot use a swapfile any longer sad

root@OpenWrt:/tera# swapon swap
Segmentation fault

Also, if I try to run mkswap:

root@OpenWrt:/tera# mkswap swap
Setting up swapspace version 1, size = 67100 kB
no label, UUID=66111dbc-1830-4ba8-a33c-722ba06c2f2e

And it hangs there.

Any ideas?

Hello,

does this work with a mmc?´Just need to change the

option device   /dev/sda2

with

option device /dev/mmc/disc0/part1

is this correct?


best regards

Pulstar wrote:

does this work with a mmc?

Why not?

i've tried, but it doesn't seem to work. when i reboot the device to apply all the settings, it just never comes up again. Not even the recovery works... hehe.

You also have installed the kernel packages for the mmc?

i've just copied the mmc.o module and started on the init file.

devnullfast wrote:

5. Add a mount section with option is_rootfs 1 for your storage device in /etc/config/fstab

config mount
        option target   /mnt
        option device   /dev/sda2
        option fstype   ext3
        option options  rw,sync
        option enabled  1
        option enabled_fsck 1
        option is_rootfs 1

(Change option device   /dev/sda2 according to your storage device. Target option is disregarded with is_rootfs 1)

I built/compiled my own OpenWRT firmware with block-extroot package. Then, I tried to add option is_rootfs 1 and my WGT634U booted and hanged at /overlay. If I remove option is_rootfs 1, my WGT634U boots just find with the external USB partition (/dev/sda1) mounted on /mnt (not on /) as shown below:

root@WGT634U:/# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/root                 2816      2816         0 100% /rom
devtmpfs                 14496         0     14496   0% /rom/dev
tmpfs                    14572        24     14548   0% /tmp
tmpfs                      512         0       512   0% /dev
/dev/mtdblock3            3584       400      3184  11% /overlay
mini_fo:/overlay          2816      2816         0 100% /
/dev/sda1               116648     13167     97459  12% /mnt

This really doesn't look good to me.

If you have the set the enabled_fsck option you also need the e2fsprogs package built into the image. Do you also have the USB support, filesystem support, block-mount, block-hotplug and block-extroot packages built into the SquashFS image?

Last time I tried, it just works like a charm smile

(Last edited by Dogge on 17 Apr 2010, 13:58)

I did a opkg list and here is the output of the list:

Escape character is '^]'.
 === IMPORTANT ============================
  Use 'passwd' to set your login password
  this will disable telnet and enable SSH
 ------------------------------------------


BusyBox v1.16.1 (2010-04-16 08:03:34 EDT) built-in shell (ash)
Enter 'help' for a list of built-in commands.

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 KAMIKAZE (bleeding edge, r20935) ------------------
  * 10 oz Vodka       Shake well with ice and strain
  * 10 oz Triple sec  mixture into 10 shot glasses.
  * 10 oz lime juice  Salute!
 ---------------------------------------------------
root@WGT634U:/# opkg list
base-files - 42-r20935
block-extroot - 0.0.1-1
block-hotplug - 0.1.0-2
block-mount - 0.1.0-2
busybox - 1.16.1-3
cfdisk - 2.13.0.1-4
curl - 7.19.6-1
ddns-scripts - 1.0.0-8
dropbear - 0.52-4
e2fsprogs - 1.41.11-1
fdisk - 2.13.0.1-4
hotplug2 - 1.0-beta-1
kernel - 2.6.33.1-1
kmod-diag - 2.6.33.1-6
kmod-ide-core - 2.6.33.1-1
kmod-ide-generic - 2.6.33.1-1
kmod-switch - 2.6.33.1-3
libblkid - 1.41.11-1
libc - 0.9.30.3-42
libcurl - 7.19.6-1
libext2fs - 1.41.11-1
libgcc - 4.3.3+cs-42
libmagic - 4.26-2
libncurses - 5.7-2
libnl-tiny - 0.1-1
libopenssl - 0.9.8m-3
libpopt - 1.7-5
libpthread - 0.9.30.3-42
libreadline - 5.2-2
librt - 0.9.30.3-42
libstdcpp - 4.3.3+cs-42
libuci - 12012009.5-1
libuuid - 1.41.11-1
mtd - 12
ntpclient - 2007_365-4
nvram - 5
opkg - 513-2
swconfig - 5
uci - 12012009.5-1
udev - 142-1
udevtrigger - 106-1
zlib - 1.2.3-5
root@WGT634U:/# lsmod
Module                  Size  Used by    Not tainted
ide_gd_mod             11360  0 
ide_pci_generic         1952  0 
ide_core               54800  2 ide_gd_mod,ide_pci_generic
switch_robo             4048  0 
switch_core             5200  1 switch_robo
diag                    7536  0

I also have the USB2 EHCI, ext4 and ext4 FS, and ide_core with its supporting modules built/compiled into the Linux kernel; otherwise, the external USB partition won't get mounted when the /etc/config/fstab doesn't have option is_rootfs 1 set. Without the ide_core + its supporting modules enabled, block-extroot package won't show on make menuconfig under Utilities -> disc menu.

(Last edited by mazilo on 17 Apr 2010, 15:34)

Emerzon wrote:

Thank you for your tip! The only problem I found is that after that I cannot use a swapfile any longer sad

root@OpenWrt:/tera# swapon swap
Segmentation fault

Also, if I try to run mkswap:

root@OpenWrt:/tera# mkswap swap
Setting up swapspace version 1, size = 67100 kB
no label, UUID=66111dbc-1830-4ba8-a33c-722ba06c2f2e

And it hangs there.

Any ideas?

I just installed Backfire 10.3 jffs2 image, moved root to stick and tested swapon on a swapfile, I can confirm that behaviour.

Adding an aditional swap partition on the stick works without any Problem.

mazilo wrote:
devnullfast wrote:

5. Add a mount section with option is_rootfs 1 for your storage device in /etc/config/fstab

config mount
        option target   /mnt
        option device   /dev/sda2
        option fstype   ext3
        option options  rw,sync
        option enabled  1
        option enabled_fsck 1
        option is_rootfs 1

(Change option device   /dev/sda2 according to your storage device. Target option is disregarded with is_rootfs 1)

I built/compiled my own OpenWRT firmware with block-extroot package. Then, I tried to add option is_rootfs 1 and my WGT634U booted and hanged at /overlay. If I remove option is_rootfs 1, my WGT634U boots just find with the external USB partition (/dev/sda1) mounted on /mnt (not on /) as shown below:

root@WGT634U:/# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/root                 2816      2816         0 100% /rom
devtmpfs                 14496         0     14496   0% /rom/dev
tmpfs                    14572        24     14548   0% /tmp
tmpfs                      512         0       512   0% /dev
/dev/mtdblock3            3584       400      3184  11% /overlay
mini_fo:/overlay          2816      2816         0 100% /
/dev/sda1               116648     13167     97459  12% /mnt

This really doesn't look good to me.

This thread is a documentation on how to use block-extroot whitout compiling anything.

Using block-extroot with a compiling enviroment ist documented here:

http://wiki.openwrt.org/doc/howto/rootf … nalstorage

You may get better help if you open up a new thread.

Hi all,

i have some problems to mount my sdcard as root-fs with Backfire 10.03.

I have installed the kmod-broadcom-sdhc package and configure the sdcard in /etc/sdcard.conf. After /etc/init.d/sdcard start my sdcard is mounted on /sdcard. After that I prepared the new root-fs and fstab as described in this howto and installed block-extroot afterwards but the device still boots from the internal rom.

do I need any additional packages ?

Thanks
Georg

You have to build an custom image with included block-extroot package....

Oh, okay, i thought it is only  necessary  to build an image if i want to use a jffs partition..
Thanks, i will try this

georg

Greetings,

I'm moving to OpenWRT after Unslung on an nslu2, and trying to figure out what is the best/proper way to use and configure OpenWRT. I have figured out that 8MB is not enough for what I want to do. However, using my old "Unix ways" knowledge makes me wonder about all this non-working fuss (sorry for the language).

Moving the whole root to an external filesystem seems like a mess requiring the user to recompile the whole system: this is made much easier than in Unslung, but still seems too much (especially on Mac OS X) just to handle a common case (stuff does not fit 8MB).

In the old days, a Unix system would have several partitions. On root (/) you would have the bare minimum to boot the system and run diagnostics. Then, you would mount /usr (for more functionality) and /var (for more data space). Later, it became common to mount /home (for user directories) which used to sit under /usr/users.

So, I wondered if I could just mount an external filesystem over /usr. The answer being, almost. /usr if full of links to busybox on /bin... WHY ARE THESE LINKS ON /usr, THEN?

From my ideal point of view, the bare image would just fill /bin and /lib. Packages would then fill /usr/bin and /usr/lib. And if /usr if not mounted, the system would just work with less (bare) functionality.

Right now, I wonder about mounting a larger filesystem somewhere, then replacing binaries with links to their copy in the larger filesystem. However, opkg will complain about lack of space (and I would feel better if opkg made its checks) and I wonder if upgrading packages replaces a file (following symlinks) or delete plus copy (thus not following symlinks). For example, python takes more than the available space...

px wrote:

I'm moving to OpenWRT after Unslung on an nslu2, and trying to figure out what is the best/proper way to use and configure OpenWRT. I have figured out that 8MB is not enough for what I want to do. However, using my old "Unix ways" knowledge makes me wonder about all this non-working fuss (sorry for the language).

I also began with NSLU2 and know the system, hardware and the community behind it quite good.

You just think to complicated.

The main difference between openwrt and nslu-linux is that openwrt was designed to support as many different devices as possible, where nslu-linux was designed for the "ultimate" nslu2 only. There are very good explanation about the difference between openwrt and nslu-linux on nslu2 ond nslu-linux.org.

In fact, Openwrt is changing a lot faster than nslu-linux and i think that peoples are thinking more general, not in details. Why thinking about what is ideal? Why talking about 8mb? Today, 8gb USB Memory is less than 14$ so just get one and move your hole filesystem on it.

im trying to get extroot working a few days now, only with half success.
i build an image, formatted the usb stick ans copied all files to it.
but when i boot the device, the flash and the stick are mounted to /overlay

root@OpenWrt:/# mount
rootfs on / type rootfs (rw)
/dev/root on /rom type squashfs (ro,relatime)
none on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,relatime)
tmpfs on /dev type tmpfs (rw,relatime,size=512k)
devpts on /dev/pts type devpts (rw,relatime,mode=600)
/dev/mtdblock3 on /overlay type jffs2 (rw,relatime)
mini_fo:/overlay on / type mini_fo (rw,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
none on /proc/bus/usb type usbfs (rw,relatime)
/dev/sda1 on /overlay type ext2 (rw,sync,noatime,errors=continue)

my fstab:

config global automount
        option from_fstab 1
        option anon_mount 1

config global autoswap
        option from_fstab 1
        option anon_swap 0

config mount
        option target   /overlay
        option device   /dev/sda1
        option fstype   ext2
        option options  rw,sync,noatime
        option enabled  1
        option enabled_fsck 1
        option is_rootfs 1

someone know why?

(Last edited by wurststulle on 9 Sep 2010, 21:08)

wurststulle wrote:

im trying to get extroot working a few days now, only with half success.
i build an image, formatted the usb stick ans copied all files to it.
but when i boot the device, the flash and the stick are mounted to /overlay

root@OpenWrt:/# mount
rootfs on / type rootfs (rw)
/dev/root on /rom type squashfs (ro,relatime)
none on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,relatime)
tmpfs on /dev type tmpfs (rw,relatime,size=512k)
devpts on /dev/pts type devpts (rw,relatime,mode=600)
/dev/mtdblock3 on /overlay type jffs2 (rw,relatime)
mini_fo:/overlay on / type mini_fo (rw,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
none on /proc/bus/usb type usbfs (rw,relatime)
/dev/sda1 on /overlay type ext2 (rw,sync,noatime,errors=continue)

my fstab:

config global automount
        option from_fstab 1
        option anon_mount 1

config global autoswap
        option from_fstab 1
        option anon_swap 0

config mount
        option target   /overlay
        option device   /dev/sda1
        option fstype   ext2
        option options  rw,sync,noatime
        option enabled  1
        option enabled_fsck 1
        option is_rootfs 1

someone know why?

I have similar problem anybody?
There are 2 versions of tutorial, one says option target   /overlay have to present,
other one says - not have to present !

both tutorials are for backfire 10.03
here says no: http://wiki.openwrt.org/doc/howto/extroot
here says yes: http://wiki.openwrt.org/inbox/howto/con … ge-overlay

so? where is the truth?
if I follow second tutorial, I have duplicated /overlay

I have the same problem.

(Last edited by Lala55 on 20 May 2013, 08:41)

The discussion might have continued from here.