1.格式化U盘为Ext4的格式
2.执行以下命令将原根目录的文件拷贝到u盘
1 2 3 4 5 6 7
| mkdir -p /tmp/introot mkdir -p /tmp/extroot mount --bind / /tmp/introot mount /dev/sda1 /tmp/extroot tar -C /tmp/introot -cvf - . | tar -C /tmp/extroot -xf - umount /tmp/introot umount /tmp/extroot
|
3.使用blkid
命令来查看sda1的UUID,结果如下:
1 2
| /dev/mtdblock5: TYPE="squashfs" /dev/sda1: UUID="c91d06ce-8781-4255-b635-610bd6beef7e" TYPE="ext4"
|
4.修改/etc/config/fstab
文件
将以下配置拷贝到文件末尾,uuid替换为你自己的uuid
1 2 3 4
| config 'mount' option target '/' option uuid 'c91d06ce-8781-4255-b635-610bd6beef7e' option enabled '1'
|
5.使用reboot
命令重启openwrt系统