Revision script:
opkg update opkg install bash
wget -O expand.sh https://www.dropbox.com/s/x2zhfqr4ssfetz1/expand.sh?dl=0 --no-check-certificate
for micro SD card:
/bin/bash expand.sh
or
/bin/bash expand.sh sda
for USB flash:
/bin/bash expand.sh sdb
for USB hard disk :
/bin/bash expand.sh sdc
"expand.sh" code:
if [ -n "$1" ]; then
device=$1
else
device="sda"
fi
driver=$device"1"
opkg update
opkg install e2fsprogs fdisk
if fdisk -l |grep /dev/$device > /dev/null; then
echo "Start"
else
echo "/dev/$device not found!"
exit 0
fi
dd if=/dev/zero of=/dev/$device bs=4096 count=10
(echo n; echo p; echo 1; echo; echo; echo w) | fdisk /dev/$device
umount -f /mnt/$driver
mkfs.ext4 /dev/$driver
mkdir -p /mnt/$driver
mount /dev/$driver /mnt/$driver
mkdir -p /tmp/cproot
mount --bind / /tmp/cproot
tar -C /tmp/cproot -cvf - . | tar -C /mnt/$driver -xf -
umount /tmp/cproot
uci add fstab mount
uci set fstab.@mount[0].target=/
uci set fstab.@mount[0].device=/dev/$driver
uci set fstab.@mount[0].fstype=ext4
uci set fstab.@mount[0].enabled=1
uci set fstab.@mount[0].enabled_fsck=0
uci set fstab.@mount[0].options=rw,sync,noatime,nodiratime
uci commit
reboot
Comments powered by CComment