Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revisionBoth sides next revision
docs:guide-user:additional-software:extroot_configuration [2023/12/01 22:44] – [3. Configuring extroot] Move formatting of USB stick philipsargentdocs: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's overlay partition. 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's overlay partition.
-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 also 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.
 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:guide-user:additional-software:extroot_configuration#custom_image|custom image]]. Devices with 8 MiB flash or more should have enough space to install the required packages, otherwise create a [[docs:guide-user:additional-software:extroot_configuration#custom_image|custom image]].
 Remove all packages you have installed to add secondary functionality, as they are only wasting space now. Remove all packages you have installed to add secondary functionality, as they are only wasting space now.
 +(If you do not have a record of what these are, try removing 'ntfs' as that may free up enough space.)
 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 ''block'' can mount. The extroot can be anything that ''block'' can mount.
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:guide-user:storage:usb-installing| USB installation guide]] to set up USB storage in OpenWrt. If you're using a USB connected device follow the [[docs:guide-user:storage:usb-installing| USB installation guide]] to set up USB storage in OpenWrt.
 +
 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.
Line 45: Line 49:
 you have extroot installed. you have extroot installed.
  
-This will install the required packages and create the extroot filesystem. +Install the required 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. +
-Please **DO NOT** run these commands blindly, verify that they are really what you want to do.+
  
 <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 kmod-usb-storage
-parted -s /dev/sda -- mklabel gpt mkpart extroot 2048s -2048s+
 </code> </code>
  
-==== 2. Configuring rootfs_data / ubifs ==== +Identify the name of the USB disk.
-Configure ''/etc/config/fstab'' to mount the ''rootfs_data'' or ''ubifs'' in another directory in case you need to access the original root overlay to change your extroot settings:+
  
 <code bash> <code bash>
-DEVICE="$(block info | sed -n -e '/MOUNT="\S*\/overlay"/s/:\s.*$//p')" +ls -/sys/block
-uci -q delete fstab.rwm +
-uci set fstab.rwm="mount" +
-uci set fstab.rwm.device="${DEVICE}" +
-uci set fstab.rwm.target="/rwm" +
-uci commit fstab+
 </code> </code>
  
-The ''/rwm'' mount will not mount via ''block'' until you've already successfully booted into your extroot configuration. +==== 2Partitioning and formatting ==== 
-This is because ''block'' has a restriction to only mount from devices that are not currently mounted. +Partition and format the USB disk.
-And ''/rwm'' should already be mounted at ''/overlay''+
-Once booted into your extroot, you can edit ''/rwm/upper/etc/config/fstab'' to change your extroot configuration (or temporarily disable it) should you ever need to. +
- +
-==== 3Configuring extroot ==== +
-See what partitions you have using the following command:+
  
 <code bash> <code bash>
-block info+DISK="/dev/sda" 
 +parted -s ${DISK} -- mklabel gpt mkpart extroot 2048s -2048s 
 +DEVICE="${DISK}1" 
 +mkfs.ext4 -L extroot ${DEVICE}
 </code> </code>
  
-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 ==== 
-/dev/mtdblock2: UUID="9fd43c61-c3f2c38f-13440ce7-53f0d42d" VERSION="4.0" MOUNT="/rom" TYPE="squashfs" +Configure the extroot mount entry.
-/dev/mtdblock3: MOUNT="/overlay" TYPE="jffs2" +
-/dev/sda1: UUID="fdacc9f1-0e0e-45ab-acee-9cb9cc8d7d49" VERSION="1.4" TYPE="ext4" +
-</code> +
- +
-Here ''mtdblock'' are the devices in internal flash memory, and ''/dev/sda1'' is the partition on a USB flash drive that we have already formatted to ext4 (see above). +
- +
-Now we configure the selected partition as new overlay via fstab UCI subsystem:+
  
 <code bash> <code bash>
Line 102: Line 88:
  
 ==== 4. Transferring data ==== ==== 4. Transferring data ====
-We now transfer the content of the current overlay to the external drive and reboot the device to apply changes:+Transfer the content of the current overlay to the external drive.
  
 <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 -
 +</code>
 +
 +==== 5. Configuring rootfs_data / ubifs ====
 +Configure a mount entry for the the original overlay.
 +
 +<code bash>
 +DEVICE="$(block info | sed -n -e '/MOUNT="\S*\/overlay"/s/:\s.*$//p')"
 +uci -q delete fstab.rwm
 +uci set fstab.rwm="mount"
 +uci set fstab.rwm.device="${DEVICE}"
 +uci set fstab.rwm.target="/rwm"
 +uci commit fstab
 +</code>
 +
 +This will allow you to access the ''rootfs_data'' / ''ubifs'' partition and customize the extroot configuration ''/rwm/upper/etc/config/fstab''.
 +
 +==== 6. Apply changes ====
 +Reboot the device to apply the changes.
 +
 +<code bash>
 reboot reboot
 </code> </code>
  • Last modified: 2024/06/28 04:31
  • by whoisroot