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/10/05 21:00] – [Introduction] vgaeteradocs: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.
  
 Note that OpenWrt is known to [[flyspray>2231|ignore]] the fstab configuration on devices without overlay partition in ''/proc/mtd''. Note that OpenWrt is known to [[flyspray>2231|ignore]] the fstab configuration on devices without overlay partition in ''/proc/mtd''.
-You can work around this with ''/'' for the mount point on ROMs without overlay partition at all.+You can work around the issue by using ''/'' for the mount point on ROMs without overlay partition at all.
  
 ===== Instructions ===== ===== Instructions =====
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.
  
-This will install the required packages and create the extroot filesystem. +Installing these packages requires a sensible amount of extra filespace. If you completely fill the filesystem by installing these,  
-**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 systemSo if you think you may already be close to filling the filesystem, 
-Please **DO NOT** run these commands blindlyverify that they are really what you want to do.+remove some installed packages first. Good candidates for removal are ntfs3 and ntfs3-utils: you can re-install them later after 
 +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 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 like this:+
  
 <code bash> <code bash>
-DEVICE="/dev/sda1" 
-mkfs.ext4 -L extroot ${DEVICE} 
-</code> 
- 
-Now we configure the selected partition as new overlay via fstab UCI subsystem: 
- 
-<code bash> 
-eval $(block info | grep -o -e 'MOUNT="\S*/overlay"') 
 eval $(block info ${DEVICE} | grep -o -e 'UUID="\S*"') eval $(block info ${DEVICE} | grep -o -e 'UUID="\S*"')
 +eval $(block info | grep -o -e 'MOUNT="\S*/overlay"')
 uci -q delete fstab.extroot uci -q delete fstab.extroot
 uci set fstab.extroot="mount" uci set fstab.extroot="mount"
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>
Line 204: Line 210:
 uci set fstab.swap.device="${DIR}/swap" uci set fstab.swap.device="${DIR}/swap"
 uci commit fstab uci commit fstab
-/etc/init.d/fstab boot+service fstab boot
  
 # 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
-  /etc/init.d/rpcd reload+  service rpcd reload
 fi fi
 </code> </code>
  • Last modified: 2024/06/28 04:31
  • by whoisroot