Hi,
I have a custom centos7 image that I created using lvm with different partitions for /var /tmp /home /opt / etc.
Now I would like to run specific commands following a resize request from sunstone (or the cli) to resize the proper and fix some GPT issues after a disk resize. However I can’t find where this process is documented or if it is possible to achieve this.
Your help is appreciated !
Thank you
Versions of the related components and OS (frontend, hypervisors, VMs):
5.4.13
Storage is managed by the OS on both the OpenNebula host and the nodes… So far I only attached SYSTEM with NFS shares, and the way that works is you export the NFS as usual - then OpenNebula ‘mounts’ the storage. So far I was only able to attach in Filesystem shared mode. I had a hard time making it happen until I realized that the “host bridge list” works only with one host - the ‘list’ must stand for multiple interfaces? In any case, you must prep your shares in the Linux OS before you can attach and use them.
I have /var/lib/one/datastores NFS exported on the OpenNebula control node. I am not sure what I did, if any on the compute nodes.
Hi, in my case i’m using ceph as shared block storage. The volume is already resized by onebula, however I need to run some gpart command into the VM to fix the GPT once resized. Is there some kind of hook that I can call after a volume resize ?
Actually it kind of work. I just noticed the udev daemon loops on trying to resize the partition running my script over and over again. Any Idea what is causing this ?
I tested the script manually and it works fine exiting 0.
FYI, here is what is my final resize script. Note that sda3 is the physical volume for lvm in all my VMs
#!/bin/bash
assignedSpace=0
freeSpace=0
for i in 1 2 3; do
let assignedSpace+=$(cat /sys/block/sda/sda$i/size)
done
let freeSpace=$(cat /sys/block/sda/size)-$assignedSpace
if [ $freeSpace -gt 8192 ]; then
cat <<EOF | parted ---pretend-input-tty /dev/sda > /dev/null 2>&1
p
f
f
resizepart 3 100%
q
EOF
pvresize /dev/sda3 > /dev/null
fi
After running into some issues with the script being called multiple times by udev which ended up running the script in parallel, I added a file lock to prevent this behaviour.
#!/bin/bash
(
flock -x 9
assignedSpace=0
freeSpace=0
for i in 1 2 3; do
let assignedSpace+=$(cat /sys/block/sda/sda$i/size)
done
let freeSpace=$(cat /sys/block/sda/size)-$assignedSpace
if [ $freeSpace -gt 8192 ]; then
cat <<EOF | parted ---pretend-input-tty /dev/sda > /dev/null 2>&1
p
f
f
resizepart 3 100%
q
EOF
pvresize /dev/sda3 > /dev/null
fi
) 9>/var/lock/pv_resize.lock