linux-system-roles / storage

Ansible role for linux storage management
https://linux-system-roles.github.io/storage/
MIT License
104 stars 59 forks source link

Cannot extend existing ext4 filesystem on LVM #407

Closed tandrez closed 4 months ago

tandrez commented 11 months ago

Hello,

I'm trying to resize an existing ext4 filesystem on top of LVM. In the example below, I want to grow /var/log from 10G to 15G.

Here are my variables:

---
storage_pools:
  - name: myvg
    disks:
      - sda2
    volumes:
      - name: var_log
        size: 15G
        fs_type: ext4
        mount_point: /var/log
      - name: var_log_audit
        size: 5G
        fs_type: ext4
        mount_point: /var/log/audit

The error when I execute the playbook:

TASK [rhel-system-roles.storage : manage the pools and volumes to match the specified state] ********************************************************************************************************************************************************************************************************************************
task path: /usr/share/ansible/roles/rhel-system-roles.storage/tasks/main-blivet.yml:77
The full traceback is:
Traceback (most recent call last):
  File "/home/vagrant/.ansible/tmp/ansible-tmp-1702041698.4188242-1076508-178520662533582/AnsiballZ_blivet.py", line 107, in <module>
    _ansiballz_main()
  File "/home/vagrant/.ansible/tmp/ansible-tmp-1702041698.4188242-1076508-178520662533582/AnsiballZ_blivet.py", line 99, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/home/vagrant/.ansible/tmp/ansible-tmp-1702041698.4188242-1076508-178520662533582/AnsiballZ_blivet.py", line 48, in invoke_module
    run_name='__main__', alter_sys=True)
  File "/usr/lib64/python3.6/runpy.py", line 205, in run_module
    return _run_module_code(code, init_globals, run_name, mod_spec)
  File "/usr/lib64/python3.6/runpy.py", line 96, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "/usr/lib64/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/tmp/ansible_blivet_payload_4u7vbvk6/ansible_blivet_payload.zip/ansible/modules/blivet.py", line 1919, in <module>
  File "/tmp/ansible_blivet_payload_4u7vbvk6/ansible_blivet_payload.zip/ansible/modules/blivet.py", line 1915, in main
  File "/tmp/ansible_blivet_payload_4u7vbvk6/ansible_blivet_payload.zip/ansible/modules/blivet.py", line 1887, in run_module
  File "/usr/lib/python3.6/site-packages/blivet/threads.py", line 53, in run_with_lock
    return m(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/blivet/formats/__init__.py", line 653, in teardown
    self._teardown(**kwargs)
  File "/usr/lib/python3.6/site-packages/blivet/threads.py", line 53, in run_with_lock
    return m(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/blivet/formats/fs.py", line 629, in _teardown
    raise FSError("umount of %s failed (%d)" % (mountpoint, rc))
blivet.errors.FSError: umount of /var/log failed (32)
fatal: [server1]: FAILED! => {
    "changed": false,
    "module_stderr": "Shared connection to 99-log-001.pvpp.infra closed.\r\n",
    "module_stdout": "Traceback (most recent call last):\r\n  File \"/home/vagrant/.ansible/tmp/ansible-tmp-1702041698.4188242-1076508-178520662533582/AnsiballZ_blivet.py\", line 107, in <module>\r\n    _ansiballz_main()\r\n  File \"/home/vagrant/.ansible/tmp/ansible-tmp-1702041698.4188242-1076508-178520662533582/AnsiballZ_blivet.py\", line 99, in _ansiballz_main\r\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\r\n  File \"/home/vagrant/.ansible/tmp/ansible-tmp-1702041698.4188242-1076508-178520662533582/AnsiballZ_blivet.py\", line 48, in invoke_module\r\n    run_name='__main__', alter_sys=True)\r\n  File \"/usr/lib64/python3.6/runpy.py\", line 205, in run_module\r\n    return _run_module_code(code, init_globals, run_name, mod_spec)\r\n  File \"/usr/lib64/python3.6/runpy.py\", line 96, in _run_module_code\r\n    mod_name, mod_spec, pkg_name, script_name)\r\n  File \"/usr/lib64/python3.6/runpy.py\", line 85, in _run_code\r\n    exec(code, run_globals)\r\n  File \"/tmp/ansible_blivet_payload_4u7vbvk6/ansible_blivet_payload.zip/ansible/modules/blivet.py\", line 1919, in <module>\r\n  File \"/tmp/ansible_blivet_payload_4u7vbvk6/ansible_blivet_payload.zip/ansible/modules/blivet.py\", line 1915, in main\r\n  File \"/tmp/ansible_blivet_payload_4u7vbvk6/ansible_blivet_payload.zip/ansible/modules/blivet.py\", line 1887, in run_module\r\n  File \"/usr/lib/python3.6/site-packages/blivet/threads.py\", line 53, in run_with_lock\r\n    return m(*args, **kwargs)\r\n  File \"/usr/lib/python3.6/site-packages/blivet/formats/__init__.py\", line 653, in teardown\r\n    self._teardown(**kwargs)\r\n  File \"/usr/lib/python3.6/site-packages/blivet/threads.py\", line 53, in run_with_lock\r\n    return m(*args, **kwargs)\r\n  File \"/usr/lib/python3.6/site-packages/blivet/formats/fs.py\", line 629, in _teardown\r\n    raise FSError(\"umount of %s failed (%d)\" % (mountpoint, rc))\r\nblivet.errors.FSError: umount of /var/log failed (32)\r\n",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
    "rc": 1
}

I believe the problem is that it cannot unmount /var/log because /var/log/audit is mounted under it. In fact, when I try to resize /var/log/audit only, it succeeds.

Also, I don't understand why it doesn't do an online resize.

I'm using RHEL System Roles on RHEL8.7.

richm commented 11 months ago

@tandrez is this related to https://github.com/linux-system-roles/storage/issues/119 ?

tandrez commented 11 months ago

@richm Reading the last comments, it seems to be related indeed. I will update my system to RHEL8.9 and report back. Thanks.

richm commented 10 months ago

@richm Reading the last comments, it seems to be related indeed. I will update my system to RHEL8.9 and report back. Thanks.

@tandrez any luck?