Bookmark

Installing and expanding OpenWrt on x86: PC, VM, and server

OpenWrt on x86 uses different images and installation steps from a conventional router flash. Distinguish a combined image with a partition table from a filesystem-only image, and identify the destination disk before writing. One incorrect dd target can erase an entire server.

Choose the image and identify the disk

Download the image for the intended use from the OpenWrt x86 documentation . For bare-metal installs, a generic-ext4-combined image normally contains boot and rootfs. For a VM, select a disk/controller that matches the hypervisor and decide whether it boots through BIOS or UEFI.

On the Linux live host, run:

1
lsblk -o NAME,SIZE,MODEL,TYPE,MOUNTPOINTS

Match the model, size, and mount points. /dev/sdd below is only a placeholder; never replace it with a real device until it has been confirmed.

Write an image to bare metal

The source uses an example such as:

1
2
3
gzip -d openwrt-19.07.8-x86-64-generic-ext4-combined.img.gz
sudo dd if=openwrt-19.07.8-x86-64-generic-ext4-combined.img of=/dev/sdd bs=4M status=progress conv=fsync
sudo fdisk -l /dev/sdd

Writing to the whole disk overwrites its partition table. Unmount every partition on that disk first and run sync afterward. Re-read and inspect the layout:

1
2
sudo partprobe /dev/sdd
lsblk /dev/sdd

Run OpenWrt in a VM

  1. Create a disk in the hypervisor and choose the BIOS or UEFI mode required by the image.
  2. Attach the image/disk to the VM and configure its network adapter and management console.
  3. Boot the VM, open its console, and identify interfaces with ip link.
  4. Set the management address, gateway, and DHCP behavior for the lab network.
  5. Do not use the host's /dev/sdd inside the VM; the guest may see the disk as /dev/vda or /dev/sda.

Expand and verify

After booting, inspect the layout and free space:

1
2
3
4
ubus call system board
lsblk
df -h
cat /proc/mtd 2>/dev/null || true

A combined image does not automatically turn all remaining disk space into rootfs. Expand it only with a tool appropriate to the image/filesystem and only after creating a backup. Test reboot, routes, DHCP/DNS, firewall, and all network interfaces.

Limits and recovery

An x86 image is not for an ARM/MIPS router. If the wrong disk was written, stop writing and restore from backup. Keep the original image, checksum, and configuration backup off the host. A Proxmox/VMware VM snapshot helps roll back the VM but is not a substitute for backing up data inside OpenWrt.

Source


0 Bình luận

Góp Ý / Bình Luận / Đánh giá