Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision Next revisionBoth sides next revision | ||
| docs:guide-user:additional-software:extroot_configuration [2023/10/05 21:02] – [Introduction] vgaetera | docs:guide-user:additional-software:extroot_configuration [2024/03/07 09:46] – kmod-usb-storage often is required as well. zpe | ||
|---|---|---|---|
| Line 14: | Line 14: | ||
| This way OpenWrt fits even in tiny amounts of internal storage (as low as 4 MiB), but still allows to write settings and install some packages in the writable partition without changing all Linux programs used. | This way OpenWrt fits even in tiny amounts of internal storage (as low as 4 MiB), but still allows to write settings and install some packages in the writable partition without changing all Linux programs used. | ||
| Extroot works by setting another overlay partition in the external storage device, and during boot this new overlay partition will be mounted over the internal storage' | Extroot works by setting another overlay partition in the external storage device, and during boot this new overlay partition will be mounted over the internal storage' | ||
| - | This approach allows easy fallback in case the external storage device is removed, as your device will still have its own overlay partition and thus will load all configuration from there. | + | This approach |
| Which means that it will behave exactly the same as just before you set up extroot. | Which means that it will behave exactly the same as just before you set up extroot. | ||
| Line 28: | Line 28: | ||
| Devices with 8 MiB flash or more should have enough space to install the required packages, otherwise create a [[docs: | Devices with 8 MiB flash or more should have enough space to install the required packages, otherwise create a [[docs: | ||
| Remove all packages you have installed to add secondary functionality, | Remove all packages you have installed to add secondary functionality, | ||
| + | (If you do not have a record of what these are, try removing ' | ||
| Leave only those needed to access the internet and needed to access the extroot filesystem. | Leave only those needed to access the internet and needed to access the extroot filesystem. | ||
| After you make the extroot you will have all the space you need to install secondary packages. | After you make the extroot you will have all the space you need to install secondary packages. | ||
| + | |||
| + | You may not need to make a custom image: try the OEM image first (OpenWRT GL.inet for a GL.inet mango). | ||
| The extroot can be anything that '' | The extroot can be anything that '' | ||
| Line 37: | Line 40: | ||
| However, it could also be on an SD-Card or a SATA drive connected via e-sata or even a network block device (assuming its set up early enough). | However, it could also be on an SD-Card or a SATA drive connected via e-sata or even a network block device (assuming its set up early enough). | ||
| If you're using a USB connected device follow the [[docs: | If you're using a USB connected device follow the [[docs: | ||
| + | |||
| The following assumes that you will be creating your extroot as an EXT4 filesystem on your OpenWRT device with a connected USB flash drive. | The following assumes that you will be creating your extroot as an EXT4 filesystem on your OpenWRT device with a connected USB flash drive. | ||
| The process is similar for other kinds of devices. | The process is similar for other kinds of devices. | ||
| - | This will install the required | + | Installing these packages |
| - | **Note: This will wipe all data on your USB stick.** It is further assumed that the USB flash shows up as block device /dev/sda. | + | you will probably have to re-flash the entire system. So if you think you may already be close to filling the filesystem, |
| - | Please **DO NOT** run these commands blindly, verify that they are really what you want to do. | + | remove some installed packages first. Good candidates for removal |
| + | you have extroot installed. | ||
| + | |||
| + | Install the required packages. | ||
| <code bash> | <code bash> | ||
| opkg update | opkg update | ||
| - | opkg install block-mount kmod-fs-ext4 e2fsprogs parted | + | opkg install block-mount kmod-fs-ext4 e2fsprogs parted |
| - | parted | + | |
| </ | </ | ||
| - | ==== 2. Configuring rootfs_data / ubifs ==== | + | Identify |
| - | Configure ''/ | + | |
| <code bash> | <code bash> | ||
| - | DEVICE=" | + | ls -l /sys/block |
| - | uci -q delete fstab.rwm | + | |
| - | uci set fstab.rwm=" | + | |
| - | uci set fstab.rwm.device=" | + | |
| - | uci set fstab.rwm.target="/ | + | |
| - | uci commit fstab | + | |
| </ | </ | ||
| - | The ''/ | + | ==== 2. Partitioning and formatting |
| - | This is because '' | + | Partition and format |
| - | And ''/ | + | |
| - | Once booted into your extroot, you can edit ''/ | + | |
| - | + | ||
| - | ==== 3. Configuring extroot | + | |
| - | See what partitions you have using the following command: | + | |
| <code bash> | <code bash> | ||
| - | block info | + | DISK="/ |
| + | parted -s ${DISK} -- mklabel gpt mkpart extroot 2048s -2048s | ||
| + | DEVICE=" | ||
| + | mkfs.ext4 -L extroot ${DEVICE} | ||
| </ | </ | ||
| - | You will see similar output: | + | This will wipe all data on the disk, so do not run these commands blindly. |
| - | <code bash> | + | ==== 3. Configuring extroot |
| - | / | + | Configure |
| - | / | + | |
| - | /dev/sda1: UUID=" | + | |
| - | </ | + | |
| - | + | ||
| - | Here '' | + | |
| <code bash> | <code bash> | ||
| - | DEVICE="/ | ||
| - | mkfs.ext4 -L extroot ${DEVICE} | ||
| - | </ | ||
| - | |||
| - | Now we configure the selected partition as new overlay via fstab UCI subsystem: | ||
| - | |||
| - | <code bash> | ||
| - | eval $(block info | grep -o -e ' | ||
| eval $(block info ${DEVICE} | grep -o -e ' | eval $(block info ${DEVICE} | grep -o -e ' | ||
| + | eval $(block info | grep -o -e ' | ||
| uci -q delete fstab.extroot | uci -q delete fstab.extroot | ||
| uci set fstab.extroot=" | uci set fstab.extroot=" | ||
| Line 102: | Line 88: | ||
| ==== 4. Transferring data ==== | ==== 4. Transferring data ==== | ||
| - | We now transfer | + | Transfer |
| <code bash> | <code bash> | ||
| mount ${DEVICE} /mnt | mount ${DEVICE} /mnt | ||
| tar -C ${MOUNT} -cvf - . | tar -C /mnt -xf - | tar -C ${MOUNT} -cvf - . | tar -C /mnt -xf - | ||
| + | </ | ||
| + | |||
| + | ==== 5. Configuring rootfs_data / ubifs ==== | ||
| + | Configure a mount entry for the the original overlay. | ||
| + | |||
| + | <code bash> | ||
| + | DEVICE=" | ||
| + | uci -q delete fstab.rwm | ||
| + | uci set fstab.rwm=" | ||
| + | uci set fstab.rwm.device=" | ||
| + | uci set fstab.rwm.target="/ | ||
| + | uci commit fstab | ||
| + | </ | ||
| + | |||
| + | This will allow you to access the '' | ||
| + | |||
| + | ==== 6. Apply changes ==== | ||
| + | Reboot the device to apply the changes. | ||
| + | |||
| + | <code bash> | ||
| reboot | reboot | ||
| </ | </ | ||
| Line 204: | Line 210: | ||
| uci set fstab.swap.device=" | uci set fstab.swap.device=" | ||
| uci commit fstab | uci commit fstab | ||
| - | / | + | service |
| # Verify swap status | # Verify swap status | ||
| Line 437: | Line 443: | ||
| # Reload rpcd to register rpc objects on the extroot | # Reload rpcd to register rpc objects on the extroot | ||
| - | | + | |
| fi | fi | ||
| </ | </ | ||