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

storage: resize function for vfat FS does not work #132

Open lilinredhat1 opened 4 years ago

lilinredhat1 commented 4 years ago

Hi, I found resize function for vfat FS does not work on rhel7. The size of disk is 20G. The size of VG is 20G. volume size has not changed when do resize from 19g to 25g, but the output by the terminal shows passed and does not report ERROR "exceed the size of disk".

playbook

---
- hosts: all
  become: true
  vars:
    mount_location: '/opt/test1'
    volume_group_size: '20g'
    volume_size_before: '19g'
    volume_size_after: '25g'
    storage_safe_mode: false

  tasks:
    - include_role:
        name: storage

    - include_tasks: get_unused_disk.yml
      vars:
        min_size: "{{ volume_group_size }}"
        max_return: 1

    - name: Create one LVM logical volume with "{{ volume_size_before }}" under one volume group
      include_role:
        name: storage
      vars:
          storage_pools:
            - name: foo
              disks: "{{ unused_disks }}"
              type: lvm
              volumes:
                - name: test1
                  fs_type: 'vfat'
                  size: "{{ volume_size_before }}"
                  mount_point: "{{ mount_location }}"

    - shell: lsblk | grep foo-test1

    - shell: mount | grep foo-test1

    - include_tasks: verify-role-results.yml

    - name: Change volume_size  "{{ volume_size_after }}"
      include_role:
        name: storage
      vars:
          storage_pools:
            - name: foo
              type: lvm
              disks: "{{ unused_disks }}"
              volumes:
                - name: test1
                  fs_type: 'vfat'
                  size: "{{ volume_size_after }}"
                  mount_point: "{{ mount_location }}"

    - shell: lsblk | grep foo-test1

    - shell: mount | grep foo-test1

    - include_tasks: verify-role-results.yml

    - name: Clean up
      include_role:
        name: storage
      vars:
          storage_pools:
            - name: foo
              disks: "{{ unused_disks }}"
              state: absent
              volumes:
                - name: test1
                  size: "{{ volume_size_after }}"
                  mount_point: "{{ mount_location }}"

    - include_tasks: verify-role-results.yml

output log

task path: /root/ansible-test/upstream/storage/tasks/main-blivet.yml:113
ok: [192.168.122.96] => {
    "blivet_output": {
        "actions": [],
        "changed": false,
        "failed": false,
        "leaves": [
            "/dev/vda1",
            "/dev/mapper/rhel_ansible--el7-swap",
            "/dev/mapper/rhel_ansible--el7-root",
            "/dev/mapper/foo-test1",
            "/dev/vdc",
            "/dev/sr0"
        ],
        "mounts": [
            {
                "dump": 0,
                "fstype": "vfat",
                "opts": "defaults",
                                                     "passno": 0,
                "path": "/opt/test1",
                "src": "/dev/mapper/foo-test1",
                "state": "mounted"
            }
        ],
        "packages": [
            "dosfstools",
            "xfsprogs",
            "e2fsprogs",
            "lvm2"
        ],
        "pools": [''' 
            {
                "disks": [
                    "vdb"
                ],
                "name": "foo",
                "state": "present",
                "type": "lvm",
                "volumes": [
                    {
                        "_device": "/dev/mapper/foo-test1",
                        "_mount_id": "/dev/mapper/foo-test1",
                        "fs_create_options": "",
                        "fs_label": "",
                        "fs_overwrite_existing": true,
                        "fs_type": "vfat",
                        "mount_check": 0,
                        "mount_device_identifier": "uuid",
                        "mount_options": "defaults",
                        "mount_passno": 0,
                        "mount_point": "/opt/test1",
                        "name": "test1",
                        "pool": "foo",
                        "size": "25g",
                        "state": "present",
                        "type": "lvm"
                    }
                ]
            }
        ],
        "volumes": []
    }
}

PLAY RECAP **************************************************************************************
192.168.122.96             : ok=173  changed=8    unreachable=0    failed=0    skipped=29   rescued=0    ignored=0
dwlehman commented 4 years ago

I'm not aware of any tooling in RHEL or fedora that can resize vfat. Am I missing something?

pcahyna commented 4 years ago

@dwlehman it is quite possible that there isn't any. parted used to support it (https://git.savannah.gnu.org/gitweb/?p=parted.git;a=blob;f=doc/parted.texi;h=ecb6574ae75eed9683c7a5287afe8136434a74bf;hb=9fd24d772de1f024a24b7fa039af3e2c6b5f9b9a#l967 ) but this code was removed after version 2.4. So the problem lies rather in tracking what is expected to work and what is not.

vojtechtrefny commented 1 month ago

The resize support was removed only from the parted CLI, libparted still supports it (with some limits), we are using libparted to support VFAT resize in libblockdev and upstream support in blivet is currently being worked on: https://github.com/storaged-project/blivet/pull/1307 -- once this change makes it to Fedora and RHEL, the role will support VFAT resize automatically.