alpine-make-vm-image
alpine-make-vm-image copied to clipboard
The outout of `fdisk -l` is confused on the vm
I use the following command to create a image.
sudo -E ./alpine-make-vm-image -f qcow2 -s 512M --mirror-uri http://mirrors.ustc.edu.cn/alpine -k lts -p "e2fsprogs-extra parted" -t -- alpinelinux.qcow2
I use virt-install
create a vm with the following command
virt-install --name alpinelinux --os-variant alpinelinux3.8 --noautoconsole --import --memory=128 --vcpus=1 --cpu host --disk path=/work/libvirt/runtime/alpinelinux.qcow2,bus=virtio --network bridge=virbr0,model=virtio
Then attach the console with virsh console alpinelinux
Connected to domain alpinelinux
Escape character is ^]
Welcome to Alpine Linux 3.15
Kernel 5.15.16-0-lts on an x86_64 (/dev/ttyS0)
localhost login: root
Welcome to Alpine!
The Alpine Wiki contains a large amount of how-to guides and general
information about administrating Alpine systems.
See <http://wiki.alpinelinux.org/>.
You can setup the system with the command: setup-alpine
You may change this message by editing /etc/motd.
localhost:~# fdisk -l
Disk /dev/vda: 512 MB, 536870912 bytes, 1048576 sectors
1040 cylinders, 16 heads, 63 sectors/track
Units: sectors of 1 * 512 = 512 bytes
Device Boot StartCHS EndCHS StartLBA EndLBA Sectors Size Id Type
/dev/vda1 09 187,180,14 784,0,13 3224498923 3657370039 432871117 206G 7 HPFS/NTFS
/dev/vda2 f4 906,235,61 262,116,59 3272020941 930513678 1953460034 931G 16 Hidden FAT16
/dev/vda3 20 370,101,50 10,114,13 0 0 0 0 6f Unknown
/dev/vda4 0,0,0 0,0,0 50200576 974536369 924335794 440G 0 Empty
Partition table entries are not in disk order
localhost:~# df -h
Filesystem Size Used Available Use% Mounted on
devtmpfs 10.0M 0 10.0M 0% /dev
shm 47.5M 0 47.5M 0% /dev/shm
/dev/vda 487.9M 120.9M 331.2M 27% /
tmpfs 19.0M 48.0K 19.0M 0% /run
cgroup_root 10.0M 0 10.0M 0% /sys/fs/cgroup
localhost:~# parted -l /dev/vda
Model: Virtio Block Device (virtblk)
Disk /dev/vda: 537MB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags:
Number Start End Size File system Flags
1 0.00B 537MB 537MB ext4
It's obvious that fdisk -l /dev/vda
return the wrong information. I searched with google but do not found an answer. Did you know why?
This tool doesn’t create partitions on the disk (it doesn’t make any sense for virtual disks, see --help
and https://github.com/alpinelinux/alpine-make-vm-image/issues/1#issuecomment-837342096), so fdisk
is somehow confused. What’s the problem here? It seems that the system booted correctly.