You are not logged in.
Pages: 1
Hi.
I created a kvm Virtual Machine using a Logical Volume as Hard Disk which I want to use as a golden image to inhert as a base installation for other Virtual Machines.
So I did
lvcreate -L 25GB -n vm_lv_fileserver vg0
dd bs=4096 if=/dev/vg0/vm_lv_golden_image of=/dev/vg0/vm_lv_fileserver
The LV has 3 Partitions (gpt partitions)
vda 254:0 0 25G 0 disk
├─vda1 254:1 0 1M 0 part
├─vda2 254:2 0 4G 0 part [SWAP]
└─vda3 254:3 0 21G 0 part /
vda3 (with file system ext4) needs to be extended for the newly created VM, so I extended the LV using
lvextend -L +975GB --resizefs /dev/vg0/vm_lv_fileserver
Size of logical volume vg0/vm_lv_fileserver changed from 25,00 GiB (6400 extents) to 1000,00 GiB (256000 extents).
Logical volume vg0/vm_lv_fileserver successfully resized.
When I try to resize the filesystem I get the following:
resize2fs /dev/vg0/ami_vm_lv_fileserver_2025
resize2fs 1.47.2 (1-Jan-2025)
resize2fs: Ungültige magische Zahl im Superblock beim Versuch, /dev/vg0/vm_lv_fileserver zu öffnen
Es kann kein gültiger Dateisystem-Superblock gefunden werden.
The german output says: No valid magic number found in super block when trying to open /dev/vg0/vm_lv_fileserver. Not able to find a valid file system super block.
What would be the solution to extend the file system located in vda3?
Also, because of using dd I ended up having the same UUID for the partions. Would that be a problem?
Thanks for your help.
Offline
It is not possible to extend partition vda3 using fdisk also. It says: Not possible to change size of /dev/vda3
Offline
If it's not a filesystem, but a partition table (for the VM). You should parted resizepart (grow partition), and resize2fs (grow filesystem), ideally from within the VM itself.
If you want to do it from the host, you'll have to kpartx or losetup --find --show --partscan to make those partitions visible on the host.
Offline
Thanks, frostschutz.
I needed to reboot the kvm-qemu machine for lvm recognizing the new possible size of the file system.
After reboot I was able to extend /dev/vda3 to the size of 996GB.
May I ask you what you think about the doubled uuids which fstab is using now (same for original and copy)?
Offline
Depending on which way you grow a disk and/or a partition you may have to inform the OS of those changes.
This
echo 1 > /sys/class/block/sdX/device/rescan
triggers a rescan (update) of an recently expanded disk. A reboot will work too.
This
partprobe /dev/sdX
informs the OS of the altered partition table. A reboot will work too.
As long as you are aware of the identical UUIDs and you don't try to add a second cloned hard disk to a previous clone or something like that, the VMs should be fine (IMHO).
Offline
Pages: 1