• openwrt wr720N 折腾小记


    之前没事的时候把wr720N刷了openwrt。

    最近公司没什么事情看到openwrt可以支持U盘挂载实现小型Linux服务器的功能,心动了,就开始折腾了。

    一开始刷的是openwrt 15.05 稳定版本,发现剩余空间太小,无法实现挂载U盘等功能。

    于是下载了trunck 版本刷进去之后,trunck 版本中不包含luci。由于没有luci 需要使用ssh进行配置。

    将路由切断电源,重新接通电源,长按reset按钮等到蓝灯快速闪烁,使用putty进入192.168.1.1

    使用passwd 重置root密码。

    重启路由,使用新的root密码使用putty登录192.168.1.1 的ssh。

    执行

    1. opkg update   
    2. opkg install block-mount kmod-fs-ext4 kmod-usb-storage-extras

    安装usb支持和ext4文件系统支持。

    插入U盘之前需要先行格式化U盘

    我将U盘格式化为三个分区

    使用fdisk 进行分区

    1g ext4

    512M swap

    剩下的 vfat

    格式化命令

    mkfs.ext4 /dev/sda1

    mkswap /dev/sda2

    mkfs.vfat /dev/sda3 

    分区结束之后。

    插入到路由usb口中,并将按钮拨到3g。

    执行命令

    1. mount /dev/sda1 /mnt  
    2. mkdir /tmp/cproot  
    3. mount --bind / /tmp/cproot  
    4. tar -C /tmp/cproot -cvf - . | tar -C /mnt -xvf -  
    5. sync  
    6. umount /mnt  
    7. umount /tmp/cproot  

    此是将/下所有文件拷贝到U盘。

    block detect > /etc/config/fstab

    更新fstab配置。

    vi /etc/config/fstab

    1. config 'global'  
    2.         option  anon_swap       '0'  
    3.         option  anon_mount      '0'  
    4.         option  auto_swap       '1'  
    5.         option  auto_mount      '1'  
    6.         option  delay_root      '5'  
    7.         option  check_fs        '0'  
    8.   
    9. config 'mount'  
    10.         option  target  '/mnt/sda1'  
    11.         option  uuid    'c91232a0-c50a-4eae-adb9-14b4d3ce3de1'  
    12.         option  enabled '0'  
    13.   
    14. config 'swap'  
    15.         option  uuid    '08b4f0a3-f7ab-4ee1-bde9-55fc2481f355'  
    16.         option  enabled '0'  
    17.   
    18. config 'mount'  
    19.         option  target  'mnt/sda3'  
    20.         option  uuid    'c1068d91-863b-42e2-bcb2-b35a241b0fe2'  
    21.         option  enabled '0'  

    将'/mnt/sda1 修改为 / 并将所有的enabled 调整为1. 保存退出。

    reboot

    重启之后可以看到U盘成为根目录。

    接下来可以安装luci 网页管理界面。

    opkg update 

    opkg install luci 

    此是流水账。日后可供参考。

    参考资料

    U盘挂载参考 http://blog.csdn.net/zcynical/article/details/44892785

    http://www.cnblogs.com/smbx-ztbz/p/4418022.html

    命令参考 http://blog.csdn.net/initphp/article/details/17396581

  • 相关阅读:
    【LeetCode】Rotate Image
    【LeetCode】Combinations
    【LeetCode】Minimum Depth of Binary Tree
    【LeetCode】Reverse Nodes in k-Group
    【LeetCode】Reverse Linked List II
    【LeetCode】Insert Interval
    【LeetCode】Insertion Sort List
    python之列表生成式
    python 模块和模块sys.argv
    python 异常处理
  • 原文地址:https://www.cnblogs.com/shiyinian/p/5183957.html
Copyright © 2020-2023  润新知