# Resize VM's volatile disk on the fly: Failed to get "write" lock

**URL:** <https://forum.opennebula.io/t/resize-vms-volatile-disk-on-the-fly-failed-to-get-write-lock/7727>\
**Category:** Product Support\
**Created:** [October 11, 2019, 12:17pm UTC](https://forum.opennebula.io/t/resize-vms-volatile-disk-on-the-fly-failed-to-get-write-lock/7727 "2019-10-11T12:17:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![gray380](https://avatars.discourse-cdn.com/v4/letter/g/7993a0/32.png) [@gray380](https://forum.opennebula.io/u/gray380)\
**Post date:** [October 11, 2019, 12:17pm UTC](https://forum.opennebula.io/t/resize-vms-volatile-disk-on-the-fly-failed-to-get-write-lock/7727/1 "2019-10-11T12:17:58Z")

</div>

Hello,

I’ve tried to resize volatile disk while VM is running.  
The task (in both cases: sunstone and cli) has failed with the following outputs:

```
Fri Oct 11 14:54:36 2019 [Z0][VM][I]: New LCM state is DISK_RESIZE
Fri Oct 11 14:54:38 2019 [Z0][VMM][I]: Command execution failed (exit code: 1): /var/lib/one/remotes/tm/qcow2/resize one-kvm-node-01-int:/var/lib/one//datastores/101/278/disk.2 51200 278 101
Fri Oct 11 14:54:38 2019 [Z0][VMM][I]: /var/lib/one/remotes/datastore/xpath.rb:66:in `block in <main>': undefined method `elements' for nil:NilClass (NoMethodError)
Fri Oct 11 14:54:38 2019 [Z0][VMM][I]: from /var/lib/one/remotes/datastore/xpath.rb:60:in `each'
Fri Oct 11 14:54:38 2019 [Z0][VMM][I]: from /var/lib/one/remotes/datastore/xpath.rb:60:in `<main>'
Fri Oct 11 14:54:38 2019 [Z0][VMM][I]: /var/lib/one/remotes/tm/qcow2/resize: line 39: [: -eq: unary operator expected
Fri Oct 11 14:54:38 2019 [Z0][VMM][E]: resize: Command "qemu-img resize /var/lib/one/datastores/101/278/disk.2 51200M" failed: qemu-img: Could not open '/var/lib/one/datastores/101/278/disk.2': Failed to get "write" lock
Fri Oct 11 14:54:38 2019 [Z0][VMM][I]: Is another process using the image [/var/lib/one/datastores/101/278/disk.2]?
Fri Oct 11 14:54:38 2019 [Z0][VMM][E]: Error resizing image /var/lib/one/datastores/101/278/disk.2
Fri Oct 11 14:54:38 2019 [Z0][VMM][I]: Failed to execute transfer manager driver operation: tm_resize.
Fri Oct 11 14:54:38 2019 [Z0][VMM][E]: Error resizing disk: Error resizing image /var/lib/one/datastores/101/278/disk.2
Fri Oct 11 14:54:38 2019 [Z0][VM][I]: New LCM state is RUNNING
Fri Oct 11 14:54:38 2019 [Z0][LCM][I]: VM disk resize operation completed.

```

System datastore (NFS share):

```
$ onedatastore show 101
DATASTORE 101 INFORMATION                                                       
ID : 101                 
NAME : emc-dd-s            
USER : oneadmin            
GROUP : tsu                 
CLUSTERS : 100                 
TYPE : SYSTEM              
DS_MAD : -                   
TM_MAD : qcow2               
BASE PATH : /var/lib/one//datastores/101
DISK_TYPE : FILE                
STATE : READY               

DATASTORE CAPACITY                                                              
TOTAL: : 1.5T                
FREE: : 893.7G              
USED: : 606G                
LIMIT: : -                   

PERMISSIONS                                                                     
OWNER : um-                 
GROUP : u--                 
OTHER : ---                 

DATASTORE TEMPLATE                                                              
ALLOW_ORPHANS="NO"
DISK_TYPE="FILE"
DS_MIGRATE="YES"
RESTRICTED_DIRS="/"
SAFE_DIRS="/var/tmp"
SHARED="YES"
TM_MAD="qcow2"
TYPE="SYSTEM_DS"

```

NFS mount options:

`hard,intr,nolock,nfsvers=3,tcp,timeo=1200,rsize=1048600,wsize=1048600,bg`

So to rezize the disk I have to power off the VM, resize the disk from webui or cli, power on the VM and after that run two commands inside the running VM:

```
sudo growpart /dev/vdb 1
sudo xfs_growfs -d /mounpoint

```

Does opennebula support online disk resizing or I’ve faced some bug?

* * *

**Versions of the related components and OS (frontend, hypervisors, VMs):**  
OpenNebula 5.8.5  
KVM nodes: CentOS Linux release 7.7.1908 (Core)  
VM: Ubuntu 19.04

**Steps to reproduce:**  
`$ onevm disk-resize 278 2 51200`

---

<div class="post-metadata">

**Author:** ![atodorov\_storpool](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/atodorov_storpool/32/5327_2.png) [@atodorov\_storpool](https://forum.opennebula.io/u/atodorov_storpool)\
**Post date:** [October 14, 2019, 6:14am UTC](https://forum.opennebula.io/t/resize-vms-volatile-disk-on-the-fly-failed-to-get-write-lock/7727/2 "2019-10-14T06:14:17Z")

</div>

Hi,

> [@gray380](#):
>
> Fri Oct 11 14:54:38 2019 [Z0][VMM][I]: Command execution failed (exit code: 1): /var/lib/one/remotes/tm/qcow2/resize one-kvm-node-01-int:/var/lib/one//datastores/101/278/disk.2 51200 278 101 Fri Oct 11 14:54:38 2019 [Z0][VMM][I]: /var/lib/one/remotes/datastore/xpath.rb:66:in `block in <main>': undefined method `elements’ for nil:NilClass (NoMethodError) Fri Oct 11 14:54:38 2019 [Z0][VMM][I]: from /var/lib/one/remotes/datastore/xpath.rb:60:in `each' Fri Oct 11 14:54:38 2019 [Z0][VMM][I]: from /var/lib/one/remotes/datastore/xpath.rb:60:in `’ Fri Oct 11 14:54:38 2019 [Z0][VMM][I]: /var/lib/one/remotes/tm/qcow2/resize: line 39: [: -eq: unary operator expected

For some reason the resize script could not get the VM’s LCM\_STATE and the following test is failing

> <https://github.com/OpenNebula/one/blob/master/src/tm_mad/common/resize#L39>

Most probably you are trying unsupported resize operation but the script is failing to raise the reason:

```auto
Not resizing disk /var/lib/one//datastores/101/278/disk.2 for running virt. machine directly

```

Please check does the _oneadmin_ user have rights to run OpenNebula commands or you are trying to resize wrong VM?

Edit: Just catch up with your other forum posts. It looks like the there si something incomplete in the reconfiguration to use non-default XMLRPC port.

Hope this helps.

Best Regards,  
Anton Todorov
