Closed vmpr closed 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.
@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
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 - 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
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:
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