Skip to content

Instantly share code, notes, and snippets.

@kilisio
Forked from rodrigojusto/EVE-NG - OpenWRT x86
Last active August 3, 2020 04:50
Show Gist options
  • Save kilisio/c0878368e80f83300636ba23e78782a0 to your computer and use it in GitHub Desktop.
Save kilisio/c0878368e80f83300636ba23e78782a0 to your computer and use it in GitHub Desktop.
create openwrt qemu image

QEMU - OpenWRT x86_64

    qemu-img create -f qcow2 hda.qcow2 1G
    # expected output
    Formatting 'hda.qcow2', fmt=qcow2 size=1073741824 encryption=off cluster_size=65536 lazy_refcounts=off refcount_bits=16

    ll
    # expected output
    -rw-r--r--  1 root root 42281968 Aug 12 02:23 hda.qcow2
    -rw-r--r--  1 root root 42281968 Aug 12 02:19 openwrt-koolshare-mod-v2.19-r8118-26796a2-x86-64-combined-squashfs.img.gz


    gzip -d openwrt-koolshare-mod-v2.19-r8118-26796a2-x86-64-combined-squashfs.img.gz

    ll
    # expected output
    -rw-r--r--  1 root root  42281968 Aug 12 02:23 hda.qcow2
    -rw-r--r--  1 root root 248844387 Aug 12 02:19 openwrt-koolshare-mod-v2.19-r8118-26796a2-x86-64-combined-squashfs.img


    dd if=openwrt-koolshare-mod-v2.19-r8118-26796a2-x86-64-combined-squashfs.img of=hda.qcow2
    # expected output
    486024+1 records in
    486024+1 records out
    248844387 bytes (249 MB, 237 MiB) copied, 1.41203 s, 176 MB/s

    qemu-img info hda.qcow2
    # expected output
    image: hda.qcow2
    file format: raw
    virtual size: 237M (248844800 bytes)
    disk size: 237M

    qemu-img resize hda.qcow2 +750M
    # expected output
    WARNING: Image format was not specified for 'hda.qcow2' and probing guessed raw.
             Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
             Specify the 'raw' format explicitly to remove the restrictions.
    Image resized.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment