Last active
February 4, 2025 20:30
-
-
Save nikescar/87469582f68a635b596420d2301f34d2 to your computer and use it in GitHub Desktop.
openwrt extroot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# openwrt extroot /dev/sda1 ext4 /dev/sda2 swap | |
# latest version https://downloads.openwrt.org/releases/19.07-SNAPSHOT/targets/ar71xx/generic/ | |
opkg update | |
opkg install kmod-usb-storage kmod-scsi-core block-mount kmod-fs-ext4 kmod-usb-uhci e2fsprogs fdisk | |
echo " | |
sysctl -w net.ipv6.conf.all.disable_ipv6=1 | |
sysctl -w net.ipv6.conf.default.disable_ipv6=1 | |
# https://forum.openwrt.org/t/fstools-extroot-may-have-a-bug/51743/2 | |
export PREINIT=1 | |
mount_root | |
exit 0 | |
" > /etc/rc.local | |
modprobe sd_mod | |
modprobe usb-storage | |
modprobe ext4 | |
lsmod | grep -Ei 'sd_mod|usb-storage|ext4' | |
# mkfs.ext4 -F /dev/sda1 #format ext4 | |
mkswap /dev/sda2 | |
mkdir -p /mnt/sda1 | |
mount /dev/sda1 /mnt/sda1 | |
mkdir -p /tmp/cproot | |
mount --bind / /tmp/cproot | |
tar -C /tmp/cproot -cvf - . | tar -C /mnt/sda1 -xf - | |
umount /tmp/cproot | |
echo " | |
config 'global' | |
option anon_swap '0' | |
option anon_mount '0' | |
option auto_swap '1' | |
option auto_mount '1' | |
option delay_root '5' | |
option check_fs '0' | |
config swap | |
option device '/dev/sda2' | |
option enabled '1' | |
config mount | |
option target '/overlay' | |
option device '/dev/sda1' | |
option enabled '1' | |
" > /etc/config/fstab | |
/etc/init.d/fstab enable | |
readlink -f /etc/rc.d/*fstab | |
# reboot | |
# after extroot | |
opkg update | |
opkg install luci-app-https-dns-proxy luci-app-banip luci-app-qos wget uclient-fetch libustream-wolfssl20150806 | |
# https://rc30-popo.hatenablog.com/entry/2019/05/15/232151 | |
# https://codebeta.com/pentest-lab-part-1-openwrt-with-extroot-f00ba4b6ffd5 | |
# https://www.pcsuggest.com/configuring-extroot-with-openwrt-on-tp-link-mr-3220/ | |
# https://samhobbs.co.uk/2013/11/more-space-for-packages-with-extroot-on-your-openwrt-router | |
# https://phillymesh.net/2016/04/11/cjdns-on-openwrt-part-2-configuring-extroot-for-more-storage/ | |
# Config Script | |
# https://github.com/valdi74/scripts/blob/master/ruter_config/make_config_script.sh | |
# https://github.com/wulfy23/files-postinstall/blob/master/0-basic/bin/opK | |
# sysupgrade -c -o -u -k -t -v openwrt-19.07-snapshot-r10841-594f731e04-ar71xx-generic-dir-825-b1-squashfs-sysupgrade.bin | |
# sysupgrade -c -o -u -v openwrt-19.07-snapshot-r10841-594f731e04-ar71xx-generic-dir-825-b1-squashfs-sysupgrade.bin |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment