Open jrjeon opened 2 years ago
Hi @jrjeon Jaram,
Thank you for sharing procedure for the loop device setup for fast-vm.
At present I'm testing integration of such solution into configure-fast-vm
script so it can be used on systems with systemd since installation.
As of now it looks something like this:
# configure-fast-vm
[inf] ==>> fast-vm configuration script
You can run this script repeatedly and interrupt it with ctrl+c.
Script will always recheck all configuration options. fast-vm system configuration will be saved in /etc/fast-vm.conf.
[inf] On systemd systems fast-vm can provide storage from loop device hosting VG. <=====
This option is intended for uses where no VFree is available on system. <=====
[?] Would you like to start the fast-vm loop device service (optional)? (y/n)y <=====
[inf] creating 10GB file /var/lib/fast-vm/loop/device.img with VG fastvm-loopdevice. <=====
[inf] starting fast-vm-loop.service <=====
Physical volume "/dev/loop100" successfully created. <=====
Volume group "fastvm-loopdevice" successfully created <=====
[?] VG for LVM thin pool
fast-vm is using LVM thin LV to store VM images and data.
Available VGs on your system are:
VG Attr VSize VFree
c8vg wz--n- <19.51g 352.00m
fastvm-loopdevice wz--n- 10.02g 10.02g <=====
======
If you lack VFree you can use the 'fastvm-loopdev' that automatically creates 10GB file in /var/lib/fast-vm/loop/ directory.
======
On which existing VG should be this thin LV?
[fastvm-loopdevice]:
...
I still need to give it a bit more testing and prepare change in documentation to describe it and also provide procedure for extending the size of it if it will become needed - I prefer to start with smaller size and allow ability to extend it instead of having huge file. For location I plan to store it in /var/lib/fast-vm/loop/
directory just next to /var/lib/fast-vm/appliance
that already exists.
Once I have some code that can be tested I will let you know here. Thank you for your time to contribute this procedure!
"truncate" creates a sparse file, hence it does not reserve space unless you actually have "real" data in it. Maybe it would be better to ask what size you want to create and by default, set it's size as 10GB.
I prefer to start with smaller size and allow ability to extend it instead of having huge file.
Ability to extend will be great, as you need to extend the size at some point.
Maybe it would be better to ask what size you want to create and by default, set it's size as 10GB.
:+1: Good point, that can be easily done during setup.
Hi @jrjeon ,
I have finally some code that can be tested if interested. Once new fast-vm packages are available they will contain the fast-vm-loop-device.service
systemd unit file installed in system (disabled by default). the changed configure-fast-vm
script now offers the creation of loop device file and start of the provided service.
On documentation side there are 2 new parts related to:
As you are already running on top of loop device provided by other service you may consider if you want to migrate to this new service provided here or stay on one created by you - I have done some changes to unit file (mostly removing things that seems to not have impact on functionality in general).
I have done only limited testing (EL8 platform) for the changes so far. Once I do more testing I will provide here the test RPMs if interested to try out the changes.
Otherwise I will keep this issue open until next version release of fast-vm (1.8) which may happen next month.
If you have any questions or feedback to above feel free to comment and once again thank you for your contribution!
Hi Ondrej,
This looks great and I will try it out when the new version got released.
Note that the step below looks very dangerous...:)
Extend the loop device size. WARNING: Be careful, you need to specify new device size that is bigger than previous one!
# du --apparent-size -h /var/lib/fast-vm/loop/device.img
51G /var/lib/fast-vm/loop/device.img
# truncate -s 61G /var/lib/fast-vm/loop/device.img
# du --apparent-size -h /var/lib/fast-vm/loop/device.img
61G /var/lib/fast-vm/loop/device.img
How about guide steps that create an extra file for a new pv and add it to vg? This will require extra work on systemd file but as "truncate" command has no protection when a shrinking file, some people might corrupt their VM images when following the steps.
Thanks for accepting new feature.
Hi Ja Ram,
I haven't found anything substantially better than truncate, but I have noticed that it supports syntax with -s +size
in which case it always makes the file bigger - the only risk is when someone forgets the +
(plus sign). I have updated documentation to recommend this approach instead.
I find it much more convenient/easy to make existing file bigger than to instruct editing of the systemd unit file which could be more dangerous. Does this new approach makes more sense to you?
Hi Ondrej,
This looks great, I didn't know to truncate has a prefix option that always increases the size of file. And I do agree that editing systemd file is a bad idea, I was just trying to avoid someone mistakenly reducing the loop device file.
When installing fast-vm, it requires extra LVM to create lvm thinpool. If there is no extra space left on your local disk, this could be an issue. It would be great when installing fast-vm it has the option to create a loop device, instead of asking for lvm to create lvm thinpool.
Please refer to the step below that I used.