Exsi 安装OpenWRT并使用gparted扩容

发布时间 2023-07-31 22:41:55作者: BionExit

Exsi 安装OpenWRT并使用gparted扩容

下载OpenWRT镜像

镜像库地址:

https://mirror.sjtu.edu.cn/openwrt/releases/[VERSION_ID]/targets/x86/64/

22.03.5下载地址

cd ~\Downloads
wget https://mirror.sjtu.edu.cn/openwrt/releases/22.03.5/targets/x86/64/openwrt-22.03.5-x86-64-generic-ext4-combined-efi.img.gz

转化并上传镜像

Brew安装qemu-img

  1. MAC操作
brew install qemu
gunzip ./openwrt-22.03.5-x86-64-generic-ext4-combined-efi.img.gz
qemu-img convert -f raw -O vmdk openwrt-22.03.5-x86-64-generic-ext4-combined-efi.img openWRT.vmdk

Qemu-img说明:https://docs.openstack.org/image-guide/convert-images.html

登录Exsi

  1. 上传VMDK文件

    上传openWRT.vmdk到Exsi openwrt_v22 文件夹下

  2. 启动Exsi SSH并连接

    ssh root@[exsi ip]
    
    [root@localhost:~] cd /vmfs/volumes/4effa38a-c996bb36-3e5f-000c29113d64
    [root@localhost:/vmfs/volumes/4effa38a-c996bb36-3e5f-000c29113d64]
    [root@localhost:/vmfs/volumes/4effa38a-c996bb36-3e5f-000c29113d64] ll
    total 1489920
    drwxr-xr-t    1 root     root         77824 Jul 30 13:06 .
    drwxr-xr-x    1 root     root           512 Jul 30 13:08 ..
    drwxr-xr-x    1 root     root         73728 Jul 30 13:06 openwrt_v22
    [root@localhost:/vmfs/volumes/4effa38a-c996bb36-3e5f-000c29113d64]cd openwrt_v22
    [root@localhost:/vmfs/volumes/4effa38a-c996bb36-3e5f-000c29113d64/openwrt_v22] vmkfstools -i openWRT.vmdk -d
     thin openWRT_thin.vmdk
    Destination disk format: VMFS thin-provisioned
    Cloning disk 'openWRT.vmdk'...
    Clone: 100% done.
    [root@localhost:/vmfs/volumes/4effa38a-c996bb36-3e5f-000c29113d64/openwrt_v22] ll
    total 60544
    drwxr-xr-x    1 root     root         73728 Jul 30 13:12 .
    drwxr-xr-t    1 root     root         77824 Jul 30 13:06 ..
    -rw-r--r--    1 root     root      26476544 Jul 30 13:06 openWRT.vmdk
    -rw-------    1 root     root     126123520 Jul 30 13:12 openWRT_thin-flat.vmkd
    -rw-------    1 root     root           534 Jul 30 13:12 openWRT_thin.vmkd
    [root@localhost:/vmfs/volumes/4effa38a-c996bb36-3e5f-000c29113d64/openwrt_v22] rm openWRT.vmdk
    rm: remove 'openWRT.vmdk'? y
    

创建虚拟机

创建虚拟机时,先创建虚拟机,接着再把之前转换好的vmdk磁盘移动至此虚拟机的目录,最后编辑虚拟机设置添加此vmdk磁盘。

![image-20230730211754742](/Users/bion/Library/Application Support/typora-user-images/image-20230730211754742.png)

![image-20230730211831881](/Users/bion/Library/Application Support/typora-user-images/image-20230730211831881.png)

此处先行创建硬盘

移动硬盘文件

![image-20230730212026914](/Users/bion/Library/Application Support/typora-user-images/image-20230730212026914.png)

![image-20230730212903684](/Users/bion/Library/Application Support/typora-user-images/image-20230730212903684.png)

![image-20230730212917024](/Users/bion/Library/Application Support/typora-user-images/image-20230730212917024.png)

编辑虚拟机,将原有硬盘删除,并调整转化后的硬盘尺寸为10G

调整OpenWRT硬盘

  1. 下载SystemRescue

  2. 将iso上传至Exsi,并挂载到OpenWRT虚拟机CD-ROM

    ![image-20230730215303591](/Users/bion/Library/Application Support/typora-user-images/image-20230730215303591.png)

    ![image-20230730215325827](/Users/bion/Library/Application Support/typora-user-images/image-20230730215325827.png)

    ![image-20230730215412857](/Users/bion/Library/Application Support/typora-user-images/image-20230730215412857.png)

    ![image-20230730215429248](/Users/bion/Library/Application Support/typora-user-images/image-20230730215429248.png)

    输入 startx启动桌面环境

    ![image-20230730215550774](/Users/bion/Library/Application Support/typora-user-images/image-20230730215550774.png)

    ![image-20230730215628143](/Users/bion/Library/Application Support/typora-user-images/image-20230730215628143.png)

    将/dev/sda2分配所有剩余空间

    保存并重启

    ![image-20230730215808016](/Users/bion/Library/Application Support/typora-user-images/image-20230730215808016.png)

    空间已完成调整

    OpenWRT 配置

    IP配置

vim /etc/config/network

![image-20230730220052406](/Users/bion/Library/Application Support/typora-user-images/image-20230730220052406.png)

重启网络

./etc/init.d/network restart

汉化包

https://downloads.openwrt.org/releases/[VERSION]/packages/x86_64/luci/

搜索luci-i18n-base-zh-cn,下载并上传

![image-20230730221855850](/Users/bion/Library/Application Support/typora-user-images/image-20230730221855850.png)

![image-20230730222058664](/Users/bion/Library/Application Support/typora-user-images/image-20230730222058664.png)