Hi John, 

Thanks! Yes, I was growing filesystems on an initial deployment from a 
small backup to a larger working volume. I had figured out the lvol module 
- that is handy! I had to do a shell command to pvresize first, though. 

Thanks for the pointers. I got it working like so:
  - name: resize the pv
    shell: pvresize /dev/xvdz
 
  - name: extend logical volumes
    lvol:
      vg: VGMagneticBU
      lv: "{{ item }}"
      size: 45%VG #Note this fails if that percentage space isn't available
      shrink: no
    with_items:
    - lv_magstaff
    - lv_magstu

  - name: extend filesystems
    filesystem:
      dev: "/dev/VGMagneticBU/{{ item }}"
      resizefs: yes
      fstype: ext4
    with_items:
    - lv_magstaff
    - lv_magstu

Thanks,
Joanna


On Friday, July 29, 2016 at 2:47:35 PM UTC-5, John Buxton wrote:
>
> If you are *growing* the fs, you first need to increase the LV size with 
> the lvol size option then increase the fs using filesystem resizefs option.
>
> However, *shrinking* the fs opens up a can of worms...
>
> You'd have do it the opposite way around: first reduce the filesystem, 
> then reduce the LV. But, looking at the code for *filesystem.py* it 
> doesn't look like you can reduce the filesystem - it prints out the message 
> saying it's doing it, but exits. It looks like it can *only* *grow* the 
> filesystem, and only when it sees that the underlying device is larger.
>
> So, you'd need to run a command rather than using the filesystem module. 
> Also, you'd need to make sure the shrink worked before resizing the 
> underlying LV, otherwise you are asking for big trouble with your data !
>
> To make things even more complicated, you can only shrink the filesystem 
> if there is sufficient free space. Even then it might not work depending on 
> how much meta data or fragmentation there is.
>
> The bottom line is that I'm not entirely sure how well suited CM tools 
> (Ansible, Puppet, etc) are to filesystem management on an on-going basis. 
> Possibly use CM for initial deployment or subsequent checking/reporting. 
> But the idea of using CM tools to perhaps *shrink* a filesystem strikes me 
> as very questionable in the first place.
>
> For example, not too long ago I dealt with a couple of systems that 
> wouldn't boot because they both had a filesystem where fsck failed because 
> the filesystem was larger than the underlying device. I'm quite sure the 
> problem was caused by some buggy Puppet manifest code which had left a data 
> corruption problem waiting to happen.
>
> On Thursday, 28 July 2016 17:49:59 UTC+1, Joanna Delaporte wrote:
>>
>> I was looking at the filesystem module today, hoping to use it to resize 
>> a filesystem that is living in a logical volume. However, I am not sure how 
>> to use it safely so it doesn't create a filesystem. Has anyone used the 
>> filesystem module to resize an LV? If so, how did you do it?
>>
>> Thanks!
>> Joanna
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/0b65727f-d37c-49f6-b1bf-8589770b3fea%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to