ronivay / XenOrchestraInstallerUpdater

Xen Orchestra install/update script
GNU General Public License v3.0
1.18k stars 189 forks source link

partition layout image.xva #70

Closed vmpr closed 3 years ago

vmpr commented 3 years ago

Hi @ronivay, thanks for your great work! really love your scripts!

I started with your image and everything works perfectly for a couple of weeks, building some new versions over time and our monitoring alarms that the HDD will be full soon. so I check it out:

Disk /dev/xvda: 20 GiB, 21474836480 bytes, 41943040 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x3a32f6f0

Device     Boot    Start      End  Sectors Size Id Type
/dev/xvda1          2048 12599295 12597248   6G 83 Linux
/dev/xvda2      12601342 20969471  8368130   4G  5 Extended
/dev/xvda5      12601344 20969471  8368128   4G 82 Linux swap / Solaris

sadly I can't grow the /dev/xvda1 partition, because the extended comes right after that.

so my question is - could u build that image in a way that the partitions are not like that? what are you using to build the virtual machine image? maybe lvm as a layer would be interesting for growing the disk in the future?

thank you and have a great start into the week. cheers, Ringo

ronivay commented 3 years ago

Hi,

Thank you. I thought i had this partitioning done already in early stages of this image. Seems that i've failed to actually deploy the changes though and haven't noticed it since.

There is now a new image in place with only one partition and extended/swap partitions removed. VM has cloud-initramfs-growroot package which automatically resizes the root partition if underlying disk is resized. Filesystem is resized only when started for the first time, but after that it needs to be done manually.

I don't think i'll implement LVM for this since it should be able to work with quite a small disk anyway and one needs to resize it probably once at most and even then it shouldn't be too big of a deal to suffer such downtime.

You may fix your existing VM by just removing the second partition which also removes the swap partition and then resize the first partition to match disk size. Also remove the swap partition from /etc/fstab and resize FS.

dsiminiuk commented 3 years ago

@vmpr I stopped using partitions for swap and now use a file.

An example for 4GB...

fallocate -l 4G /swapfile
dd if=/dev/zero of=/swapfile bs=1024 count=4194304

chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
swapon --show

Edit /etc/fstab and change your swap line item to

/swapfile       swap        swap    defaults    0   0

reboot

vmpr commented 3 years ago

thanks guys! @ronivay - I've fixed it in my existing VM and all good now, bit dodgy feeling to remove your first partition and create it new but bigger :) @dsiminiuk thanks, I also went with the swap file :)

ronivay commented 3 years ago

@ronivay - I've fixed it in my existing VM and all good now, bit dodgy feeling to remove your first partition and create it new but bigger :)

haha, i know the feeling. Luckily there's tools like parted which make that feel little safer, but fdisk is fine when you know that it's totally normal to do so :D